[R] Automating Plot Commands using a Loop

Koraelus koraelus at yahoo.com
Wed Nov 11 19:58:07 CET 2009


Hello,

Thank you for responding! The data is in the same format as the example I
showed earlier. The data is different from matrix to matrix, but the general
format is:

                  Time1    Time 2   Time3  Time4
Species1     1            3            4         5
Species2     3            4            5         6
Species3    3           4             5           6

The problem I had was that I wanted to graph the species values (which are
different from matrix to matrix) through time - i.e. values y-axis and time
x-axis, so I transposed the matrix such that the species would be the
columns and time would be the rows so that this would be easier to code. 

If I code it without using a formula:

plot(Data$Species1,type="o",axes=F,ann=F,ylim=c(0,1))

It works perfectly fine.

Thanks,
Andrew Z.


Why did you transpose the dataframe (TData <- t(Data))?  Is your data
in the same structure as is expected.  Provide either the data file
you are plotting, or at least an 'str' of the object.
-- 
View this message in context: http://old.nabble.com/Automating-Plot-Commands-using-a-Loop-tp26273268p26306647.html
Sent from the R help mailing list archive at Nabble.com.




More information about the R-help mailing list