Re: [R] Question about addressing a data frame

2019-04-25 Thread Nitu, Laurentiu
AM To: Nitu, Laurentiu Cc: r-help@r-project.org Subject: Re: [R] Question about addressing a data frame is.na<http://is.na>(DF) is a matrix for a data.frame DF. The semantics of '[" are different for matrices and data.frame and that can cause confusion > DF <- data.frame(X=

Re: [R] Question about addressing a data frame

2019-04-25 Thread William Dunlap via R-help
is.na(DF) is a matrix for a data.frame DF. The semantics of '[" are different for matrices and data.frame and that can cause confusion > DF <- data.frame(X=c(101,NA,NA), Y=c("one","two",NA), row.names=c("i","ii","iii")) > is.na(DF) # returns a matrix when given a data.frame X Y i FA

[R] Question about addressing a data frame

2019-04-25 Thread Nitu, Laurentiu
Hello, I have this data frame [algae] in the package DMwR. I thought I understand how to refer an element but I cannot explain... is.na(algae) is giving us the a logical vector with TRUE being the na's. which(is.na(algae)) gives the positions on the elements in the data frame where is.na retur