[R] data frame output in loops

2005-05-06 Thread Apoian, Zack
I know this is very basic--I'm wondering if there is a  way to write data 
frames as outputs from a loop.
In other words, take this simple example:
 
> a <- data.frame(x = c(1,2,3,4), y = c(1,2,1,2))
 
Given a, how would you write a loop that creates two data frames, x and y, 
where the first column is a column of a and the second column is two times the 
first column, or:
 
> x
  x.1 x.2
1   1   2
2   2   4
3   3   6
4   4   8

 
and 
 
> y
  y.1 y.2
1   1   2
2   2   4
3   1   2
4   2   4

 


DISCLAIMER: This e-mail message and any attachments are inte...{{dropped}}

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] plotting multiple series in one plot

2004-11-26 Thread Apoian, Zack
say we have:

> x<-data.frame(a=c(1,2,3,4,5),b=c(1,1,1.5,2,2))
> y<-data.frame(a=c(1,2,3,4,5),b=c(1,2,2,3,3))

How would I plot this so that, with the shared $a as the x-axis values, I
have both $b columns plotted together?  (a comparison of the two?)

thanks.


DISCLAIMER: This e-mail message and any attachments are inte...{{dropped}}

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] referencing values of strings

2004-11-17 Thread Apoian, Zack
Say you have a vector named x and a function which returns the character
string "x" .  How would I take "x" as an input and return the vector x?


DISCLAIMER: This e-mail message and any attachments are inte...{{dropped}}

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] plot question

2004-11-16 Thread Apoian, Zack
Say y and z are two time series (functions of "date").  What is the R
command to plot y and z together on a graph with "date" on the x-axis?



DISCLAIMER: This e-mail message and any attachments are inte...{{dropped}}

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html