Click here to Skip to main content
15,887,596 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I'm trying to use a table I have on an external file by importing it and using it to make some graphics.

On the blank spaces in this document I put NA, but it still considering them as values...

How can I make it so these values are considered non-existing ?

My script:

datafilename <- "SGX.txt"
person.data  <- read.table(datafilename, header=TRUE, na.strings = c("NA", " "))

panel.cor <- function(x, y, digits=2, prefix="", cex.cor, ...)
{
    usr <- par("usr"); on.exit(par(usr))
    par(usr = c(0, 1, 0, 1))
    r <- abs(cor(x, y))
    txt <- format(c(r, 0.123456789), digits=digits)[1]
    txt <- paste(prefix, txt, sep="")
    if(missing(cex.cor)) cex.cor <- 0.8/strwidth(txt)
    text(0.5, 0.5, txt, cex = cex.cor * r)
}

pairs(~O3_s+NO2_s+CO_s1+CO_s2+T_ref+HR_ref+HA_ref+PP_ref+Rad_ref+VV_ref+DV_ref+P_ref, data=person.data,
      upper.panel=panel.smooth, lower.panel=panel.cor, 
      pch=20, main="SGX Scatterplot Matrix")

summary(person.data)

boxplot(person.data)


PS: I'm using R, codeproject didn't recognize the tag so I put programming.
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900