[R] plotting single variables common to multiple data frames

Mathew Brown mathew.brown at forst.uni-goettingen.de
Tue May 24 16:38:05 CEST 2011


Here is some data. Only one day as two days were too big. The structure 
is kind of strange and I'm not sure how to 'grab' a single variable from 
it to plot. I would be happy if someone could tell me how to do that.

Cheers


On 5/24/2011 3:55 PM, John Kane wrote:
> None of the files came through.  The R-help list routinely srips off all attachments to cut down on the change of viri . 
>
> You could provide the data in the email by using dput.  Type ?dput in the R console to get the help page.
>
> It is not clear from what you write whether you want a line with one set of data consisting of all the data from the seven files or if you want 7 lines (dots whatever) one for each day.
>
> A brute force way for the first approach is to combine all the data.frames using rbind, and plot from there.
>
> Example
> =====================================================
> xx<- data.frame(aa=1:10, bb = letters[1:10])
> yy<- data.frame(aa=11:20,  bb = letters[11:20])
> zz<- data.frame(aa=21:30, bb= sample(letters[1: 26], 10))
>
> df1<- rbind(xx,yy,zz)
> plot(df1$aa)
>
>
> ======================================================
>
> If you want 7 sets someone else probably has a simple solution. Without your sample data it's bit bit hard to guess.
>
>
>
>
>
>
>
> --- On Tue, 5/24/11, Mathew Brown<mathew.brown at forst.uni-goettingen.de>  wrote:
>
>> From: Mathew Brown<mathew.brown at forst.uni-goettingen.de>
>> Subject: [R] plotting single variables common to multiple data frames
>> To: r-help at r-project.org
>> Received: Tuesday, May 24, 2011, 8:55 AM
>>
>>
>>
>> Hello all,
>>
>> I have files (see attached) which are created daily. I want
>> to load
>> about a weeks worth of them (7 daily files) and plot a
>> weeks worth of
>> one variable together. So one variable name is delta_D_H. I
>> would like
>> to plot this variable from all 7 days on one plot. I'm
>> having trouble
>> figure out how to do this.
>>
>> I've loaded them all up using this
>>
>> time=Sys.time()
>> t1<- as.numeric(format.Date(time, "%Y%m%d"))
>> #date range of data to load
>> paluiso= c(); yy = c();
>> t1=t1-1
>> t0<-t1-7
>> x = t0:t1
>> for (i in seq( length(x) ) ) {
>>       
>> y=load(paste(datalocation,x[i],".RData", sep=""))
>>        e3<- new.env()
>>     yy[[i]]<- get('isot', e3)
>> }
>>
>> but I don't know how to grab single variables from these
>> data frames and
>> plot them.
>>
>> Any help is appreciated!
>>
>> M
>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: stuff
URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20110524/e1baf781/attachment-0001.pl>


More information about the R-help mailing list