[R] coursera course - assgnment - error : Error in which(!is.Na(content[["sulfate"]])) : , could not find function "is.Na"
    Roelof Wobben 
    r.wobben at home.nl
       
    Thu Nov  3 17:40:07 CET 2016
    
    
  
Hello,
I want to try to get all the data of a cloumn namend "sulfate" which is 
not Na.
So I did :
corr <- function(directory, threshold = 0) {
   # lezen van alle bestanden in  de directory
   file_list <-  list.files( directory, pattern = "*.csv", full.names = 
TRUE)
    # lezen van alle bestanden in a loop
   #  1) bepalen van de complete_cases
   #  2) controleren of het hoger/lager is dan de treshold.
   #  3) als het hoger is.
   #     a) lezen van de nitraat en controleren of het geen Na is
   #     b) lezen van de sulfaat en controleren of het geen Na is.
   #     c) als beide geen Na zijn, dan de correlatie bepalen
   for(file in file_list) {
     content <- read.csv(file)
     if (complete.cases(content) > 0) {
       sulfate <- which (!is.Na(content[["sulfate"]]))
       print(sulfate)
     }
     }
   }
but now I see the above error.
What did I do wrong ?
Regards,
Roelof
    
    
More information about the R-help
mailing list