[R] Simple plotting errors

Simon Pickett simon.pickett at bto.org
Mon May 18 13:35:02 CEST 2009


you mean you want to plot "SUM" against month? (assuming these12 data frames 
are 12 months).

you could first bind them all together using data.frame(), see ?data.frame 
which would make it much easier.

you need to create a variable for months then plot it against your variable. 
If you dont want to make it easier with a data frame then you would have a 
long piece of code as follows (assuming I have understood you correctly)

plot(seq(1:12),c(FeketeJAN$(SUM_)[row.names(FeketeJAN)=="AMAZON"],FeketeFEB$(SUM_)[row.names(FeketeFEB)=="AMAZON"]....etc))

Cheers, Si.


----- Original Message ----- 
From: "Steve Murray" <smurray444 at hotmail.com>
To: <r-help at r-project.org>
Sent: Monday, May 18, 2009 12:17 PM
Subject: [R] Simple plotting errors


>
> Dear R Users,
>
> I have 12 data frames, each of 12 rows and 2 columns.
>
> e.g. FeketeJAN
>                   MEAN    SUM_
> AMAZON      144.4997874 68348.4
> NILE          5.4701955  1394.9
> CONGO        71.3670036 21196.0
> MISSISSIPPI  18.9273250  6511.0
> AMUR          1.8426874   466.2
> PARANA       58.3835497 13486.6
> YENISEI       1.4668313   592.6
> OB            1.4239179   559.6
> LENA          0.9342164   387.7
> NIGER         4.7245709   826.8
> ZAMBEZI      76.6893794  8665.9
> YANGTZE      10.6759257  1729.5
>
>
> I want to do a line plot of the value of Amazon 'Sum' (in this case, 
> 68348.4) for each of the 12 data frames. I've tried doing this as follows:
>
> plot(FeketeJAN[1,2], FeketeFEB[1,2], FeketeMAR[1,2], *through to December* 
> type="l")
>
> but receive: Error in strsplit(log, NULL) : non-character argument
>
>
> I've also tried:
>
> plot(FeketeJAN$AMAZON[,2], FeketeFEB$AMAZON[,2], *through to December* 
> type="l")
>
> but receive:
>
> 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
> 3: In min(x) : no non-missing arguments to min; returning Inf
> 4: In max(x) : no non-missing arguments to max; returning -Inf
>
>
> What is it that I'm doing wrong?!
>
> Many thanks for any advice,
>
> Steve
>
>
>
> _________________________________________________________________
> [[elided Hotmail spam]]
>
> ______________________________________________
> 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.
>




More information about the R-help mailing list