Re: [R] General Plotting Question

From: Yasir Kaheil <kaheil_at_gmail.com>
Date: Tue, 06 May 2008 11:21:08 -0700 (PDT)

the data frames work as follows: columns= variables and rows= records. when you plot with a data frame it's logical to plot one variable against another not one record against another. with casting into a matrix and rotating then casting back into a dataframe, you made your records variables.. this is why it worked.
I hope this makes sense to you. Thanks

stephen sefick wrote:
>
> Thanks for the help- It worked just fine:
> This will cast my ignorance across the table, but here it goes. Why do I
> need to make them a matrix? because they are in a row? if
> d <- as.matrix(f)
> f.t <- t(d)
> f.m <- as.data.frame(f.t)
> now I could use just the following
>
> plot(f.m[c(rownumber), column], f.m[c(rownumber), column])
>
> ?
>
> I am sure that I need to brush up on underlying data structures, but I am
> trying to analyze data as we speak and R along with all of your help is an
> invaluable tool. Am I missing something easy, do I not understand the
> logic/philosophy, or...?
> thanks
>
> Stephen
>
> On Tue, May 6, 2008 at 12:53 PM, Yasir Kaheil <kaheil_at_gmail.com> wrote:
>

>>
>> cast the two vectors as.matrix-- see here:
>> plot(as.matrix(f[2,4:26]), as.matrix(f[1,4:26]))
>>
>> y
>>
>>
>> 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?
>> >
>> > thanks
>> >
>> > stephen
>> > --
>> > Let's not spend our time and resources thinking about things that are
>> so
>> > little or so large that all they really do for us is puff us up and
>> make
>> > us
>> > feel like gods. We are mammals, and have not exhausted the annoying
>> little
>> > problems of being mammals.
>> >
>> > -K. Mullis
>> >
>> >       [[alternative HTML version deleted]]
>> >
>> > ______________________________________________
>> > R-help_at_r-project.org mailing list
>> > 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.
>> >
>> >
>>
>>
>> -----
>> Yasir H. Kaheil, Ph.D.
>> Catchment Research Facility
>> The University of Western Ontario
>>
>> --
>> View this message in context:
>> http://www.nabble.com/General-Plotting-Question-tp17087346p17087502.html
>> Sent from the R help mailing list archive at Nabble.com.
>>
>> ______________________________________________
>> R-help_at_r-project.org mailing list
>> 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.
>>

>
>
>
> --
> Let's not spend our time and resources thinking about things that are so
> little or so large that all they really do for us is puff us up and make
> us
> feel like gods. We are mammals, and have not exhausted the annoying little
> problems of being mammals.
>
> -K. Mullis
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help_at_r-project.org mailing list
> 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.
>
>


Yasir H. Kaheil, Ph.D.
Catchment Research Facility
The University of Western Ontario
-- 
View this message in context: http://www.nabble.com/General-Plotting-Question-tp17087346p17089290.html
Sent from the R help mailing list archive at Nabble.com.

______________________________________________
R-help_at_r-project.org mailing list
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.
Received on Tue 06 May 2008 - 18:35:07 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Tue 06 May 2008 - 19:30:35 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive