Re: [R] Plot rows of CSV

From: Joshua Wiley <jwiley.psych_at_gmail.com>
Date: Fri, 27 May 2011 13:59:38 -0700

Hi,

This is not fancy or especially elegant, but....

## so you can see each plot at a time before moving on par(ask = TRUE)
## apply() the function plot() to each row of the ## rows of mtcars you extracted by name
apply(mtcars[c("Mazda RX4", "Merc 450SLC", "Maserati Bora"), ], 1, plot)

I use as an example the mtcars dataset. As long as you have your data in R with row names, something like this should work. Importantly, apply() coerces the object it functions on to a matrix, so if you have character and numeric data, everything will be converted to the highest level of the hierarchy (see the documentation for ?cbind to see the hierarchy of data types).

If you need more specific types of plots, be more specific ;)

Cheers,

Josh

On Fri, May 27, 2011 at 10:27 AM, rmje <robinmjelle_at_gmail.com> wrote:
> http://r.789695.n4.nabble.com/file/n3555898/example.jpg
>
> Hi,
>
> I have a CSV-file (see image) that I would like to plot.
>
> I want to make a plot-function where I only plot one row at the time. I want
> to define which row to plot in the function based on the row-names
> (non-numeric) in column 1 in the CSV-file.
>
> Could you help me out?
>
> --
> View this message in context: http://r.789695.n4.nabble.com/Plot-rows-of-CSV-tp3555898p3555898.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.
>

-- 
Joshua Wiley
Ph.D. Student, Health Psychology
University of California, Los Angeles
http://www.joshuawiley.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 Fri 27 May 2011 - 21:01:52 GMT

This quarter's messages: by month, or sorted: [ by date ] [ by thread ] [ by subject ] [ by author ]

All messages

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 Mon 30 May 2011 - 14:20:10 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