[R] General Plotting Question

Duncan Murdoch murdoch at stats.uwo.ca
Tue May 6 18:55:57 CEST 2008


On 5/6/2008 12:43 PM, stephen sefick wrote:
> f <- (structure(list(X = structure(96:97, .Label = c("119DAmm", "119DN",
> "119DNN", "119DO", "119DOC", "119Flow", "119Nit", "119ON", "119OPhos",
> "119OrgP", "119Phos", "119TKN", "119TOC", "148DAmm", "148DN",
> "148DNN", "148DO", "148DOC", "148Flow", "148Nit", "148ON", "148OPhos",
> "148OrgP", "148Phos", "148TKN", "148TOC", "179DAmm", "179DN",
> "179DNN", "179DO", "179DOC", "179Flow", "179Nit", "179ON", "179OPhos",
> "179OrgP", "179Phos", "179TKN", "179TOC", "185DAmm", "185DN",
> "185DNN", "185DO", "185DOC", "185Flow", "185Nit", "185ON", "185OPhos",
> "185OrgP", "185Phos", "185TKN", "185TOC", "190DAmm", "190DN",
> "190DNN", "190DO", "190DOC", "190Flow", "190Nit", "190ON", "190OPhos",
> "190OrgP", "190Phos", "190TKN", "190TOC", "198DAmm", "198DN",
> "198DNN", "198DO", "198DOC", "198Flow", "198Nit", "198ON", "198OPhos",
> "198OrgP", "198Phos", "198TKN", "198TOC", "202DAmm", "202DN",
> "202DNN", "202DO", "202DOC", "202Flow", "202Nit", "202ON", "202OPhos",
> "202OrgP", "202Phos", "202TKN", "202TOC", "215DAmm", "215DN",
> "215DNN", "215DO", "215DOC", "215Flow", "215Nit", "215ON", "215OPhos",
> "215OrgP", "215Phos", "215TKN", "215TOC", "61DAmm", "61DN", "61DNN",
> "61DO", "61DOC", "61Flow", "61Nit", "61ON", "61OPhos", "61OrgP",
> "61Phos", "61TKN", "61TOC", "BCOPhos", "BCOrgP", "BCPhos", "BCTKN",
> "BCTOC", "HCDAmm", "HCDN", "HCDNN", "HCDO", "HCDOC", "HCFlow",
> "HCNit", "HCON", "HCOPhos", "HCOrgP", "HCPhos", "HCTKN", "HCTOC",
> "SCDAmm", "SCDN", "SCDNN", "SCDO", "SCDOC", "SCFlow", "SCNit",
> "SCON", "SCOPhos", "SCOrgP", "SCPhos", "SCTKN", "SCTOC"), class = "factor"),
> 
>     RiverMile = structure(c(8L, 8L), .Label = c("119", "148",
>     "179", "185", "190", "198", "202", "215", "61", "BC", "HC",
>     "SC"), class = "factor"), Constituent = structure(5:6, .Label =
> c("DAmm",
>     "DN", "DNN", "DO", "DOC", "Flow", "Nit", "ON", "OPhos", "OrgP",
>     "Phos", "TKN", "TOC"), class = "factor"), X2.1.06 = c(2.5,
>     2494), X4.1.06 = c(2.4, NA), X5.1.06 = c(2.3, NA), X6.1.06 = c(2.1,
>     NA), X7.1.06 = c(2, NA), X8.1.06 = c(1.9, NA), X9.1.06 = c(2,
>     NA), X10.1.06 = c(2.1, NA), X11.1.06 = c(2.9, NA), X12.1.06 = c(2.6,
>     NA), X1.1.07 = c(2.1, 4229.55), X2.1.07 = c(2.1, 1823.5),
>     X3.1.07 = c(2.8, 3617.5), X4.1.07 = c(2.3, NA), X5.1.07 = c(3.5,
>     NA), X6.1.07 = c(2.8, 10974.5), X7.1.07 = c(2.5, 9652), X8.1.07 = c(2.4,
> 
>     6700.5), X9.1.07 = c(2.2, 11438.5), X10.1.07 = structure(c(34L,
>     33L), .Label = c("-0.0214", "-0.3660", "#VALUE!", "0.0000",
>     "0.0010", "0.0040", "0.0060", "0.0080", "0.0086", "0.0090",
>     "0.0100", "0.0110", "0.0120", "0.0140", "0.0220", "0.0230",
>     "0.0240", "0.0280", "0.0300", "0.0720", "0.0890", "0.1000",
>     "0.1200", "0.1280", "0.1400", "0.1500", "0.1880", "0.1910",
>     "0.2000", "0.2080", "0.2200", "0.3900", "1141.0000", "2.2000",
>     "2.3000", "2.5000", "2.6000", "2606.0000", "3.0000", "3.4000",
>     "4.5000", "4.6000", "4710.0000", "4720.0000", "4729.0000",
>     "6.9768", "7.7065", "7.7338", "8.0097"), class = "factor"),
>     X11.1.07 = c(2.2, 10968), X12.1.07 = c(2.2, 7361.5), X1.1.08 = c(2,
>     6797)), .Names = c("X", "RiverMile", "Constituent", "X2.1.06",
> "X4.1.06", "X5.1.06", "X6.1.06", "X7.1.06", "X8.1.06", "X9.1.06",
> "X10.1.06", "X11.1.06", "X12.1.06", "X1.1.07", "X2.1.07", "X3.1.07",
> "X4.1.07", "X5.1.07", "X6.1.07", "X7.1.07", "X8.1.07", "X9.1.07",
> "X10.1.07", "X11.1.07", "X12.1.07", "X1.1.08"), row.names = c(NA,
> -2L), class = "data.frame"))
> 
> plot(f[2,4:26], f[1,4:26])
> 
> #Error in plot.window(...) : need finite 'xlim' values
> #In addition: Warning messages:
> #1: In min(x) : no non-missing arguments to min; returning Inf
> #2: In max(x) : no non-missing arguments to max; returning -Inf
> 
> #I want a scatterplot like what I thought would happen with the plot command
> and the rows and columns that contain the data.  If there is a NA in either
> case there is no point .  plotted.  This is how plot works with the data in
> columns, I think.  This is a small example of a much larger data set are
> there any suggestions.  What am I missing?

You need to look closely at your data.  It's not all numeric; column 23 
is a factor, because of that "#VALUE!" entry.

Duncan Murdoch



More information about the R-help mailing list