[R] data file with columns of unequal length

Jim Lemon jim at bitwrit.com.au
Fri Oct 23 11:31:46 CEST 2009


On 10/23/2009 07:58 PM, William Simpson wrote:
> I am running an expt that presents a point process input x and
> measures a point process output y. The times of each event are
> recorded. The lengths of the data records of x and y are necessarily
> different, and can be different by a factor of 10. I would like to
> save these data after each experiment as a file with two columns, one
> for x and one for y.
>
> However, R dataframes require columns of equal length. One solution is
> to fill the "empty" places in y with NAs so it has the same length as
> x. I view that as unsatisfactory (there are in reality no missing
> values). Another possibility is to store x and y in separate files. I
> also view that as unsatisfactory (it is too easy to lose track of the
> y file corresponding to a given x file).
>
> Can anyone suggest a way to deal with this situation?
>
>    
Hi Bill,

xy<-list(x=1:10,y=1:100)

Note that this cheerfully ignores how you are going to figure out which 
x goes with which y(s).

Jim




More information about the R-help mailing list