matloff / fasteR

Fast Lane to Learning R!
958 stars 154 forks source link

Wrong example in Lesson 18. #15

Open khangquangtran opened 2 years ago

khangquangtran commented 2 years ago

In Lesson 18, in the second code section, "this little example":

> d <- data.frame(x=c(1,0,3),y=c(0,0,13)) > d x y 1 1 0 2 0 0 > which(d[,2] == 0) [1] 1 2 # ah yes; the 0 elements in column 2 are at indices 1 and 2

The data frame d should have 3 rows and 2 columns and should be as follows (sorry, I can't add whitespaces in front of "x y"): x y 1 1 0 2 0 0 3 3 13