R version 2.5.0 (2007-04-23) Copyright (C) 2007 The R Foundation for Statistical Computing ISBN 3-900051-07-0 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. Natural language support but running in an English locale R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. Error in options(device = x11) : object "x11" not found > if(!exists("baseenv", mode="function")) baseenv <- function() NULL options(STERM='iESS', editor='emacsclient') > > > source("../hmwrk1Data.R") [1] "The variables defined here are x1, x2, p1 and f1" > length(x1) [1] 10 > oddInd <- seq(1,9, by=2) > oddInd [1] 1 3 5 7 9 > y1 <- x1[oddInd] > x1 [1] 1.1 -2.3 2.5 0.5 -3.2 -4.0 5.2 -2.2 -2.2 3.0 > y1 [1] 1.1 2.5 -3.2 5.2 -2.2 > y2 <- x1 > y2[x1 <= 0] <- 0 > y2 [1] 1.1 0.0 2.5 0.5 0.0 0.0 5.2 0.0 0.0 3.0 > y3 <- log(x2) > y3 [1] 1.6094379 2.0794415 0.6931472 1.1939225 1.7227666 2.1041342 1.4816045 > yy <- log(x1) Warning message: NaNs produced in: log(x) > yy [1] 0.09531018 NaN 0.91629073 -0.69314718 NaN NaN [7] 1.64865863 NaN NaN 1.09861229 > m <- sum(x1*p1) > m3 <- sum( (x1-m)^3 *p1) > y4 <- as.integer(x1 <= 0) > y4 [1] 0 1 0 0 1 1 0 1 1 0 > sum(x1 <=0) [1] 5 > f1 [1] M M F f f F m m M M F Levels: F M f m > f2 <- f1 > f2[f1 == "m"] <- "M" > f2[f1 == "f"] <- "F" > f2 [1] M M F F F F M M M M F Levels: F M f m > f3 <- factor(as.character(f2)) > f3 [1] M M F F F F M M M M F Levels: F M > ?dnorm > pnorm(2) [1] 0.9772499 > pnorm(0) [1] 0.5 > qnorm(.95) [1] 1.644854 > q() Save workspace image? [y/n/c]: n Process R:2 finished at Mon Sep 10 14:35:24 2007