Forum Discussion
Using R in Query Editor
- 7 years ago
To me it looks like you aren't referencing the missing values column of completedData correctly.
When you load the data using dataset <-read.csv, by default it replaces the spaces within column names with periods. In particular, "SMI missing values" becomes "SMI.missing.values" so the last step in the R script doesn't do anything since it refers to a nonexistant column.
There are two easy fixes. Pick one or the other but not both.
- Change the last line.
output$completedValues <- completedData$"SMI missing values"
output$completedValues <- completedData$"SMI.missing.values" - Add an argument to read.csv to prevent this replacement.
dataset <- read.csv (file = "<path>", header = TRUE, sep = ",")
dataset <- read.csv (file = "<path>", header = TRUE, check.names=FALSE, sep = ",")
- Change the last line.
It looks as if your simply referencing the wrong field from the table. In the column [Value], click on the "Table" in the first row instead of the second.
ImkeF The output table is supposed to have three columns where the third reads from the second column of completedData.
Neither of those two tables produces the expected output since the column reference is getting messed up in the last line of the R script like I explained above.