[R] coursera course - assgnment - error : Error in which(!is.Na(content[["sulfate"]])) : , could not find function "is.Na"

Rui Barradas ruipbarradas at sapo.pt
Thu Nov 3 18:31:38 CET 2016


Hello,

Just read the error message more carefully.
The function name is the (obvious) problem! Try, with all lowercase,

is.na()

Hope this helps,

Rui Barradas

Em 03-11-2016 16:40, Roelof Wobben escreveu:
> 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
>
> ______________________________________________
> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list