--- Christian Convey <[EMAIL PROTECTED]>
wrote:

> I'd like to have a data.frame structured something
> like the following:
> 
> d <- data.frame (
>    x=list( c(1,2), c(5,2), c(9,1) ),
>    y=c( 1, -1, -1)
> )
> 
> The reason is this: 'd' is the training data for a
> machine learning
> algorithm.  d$x is the independent data, and d$y is
> the dependent
> data.
> 
> In general my machine learning code will work where
> each element of
> d$x is a vector of one or more real numbers.  So for
> instance, the
> same code should work when d$x[1] = 42, or when
> d$x[1] = (42, 3, 5).
> All that matters is that all element within d$x are
> lists/vectors of
> the same length.
> 
> Does anyone know if/how I can get a data.frame set
> up like that?
> 
> Thanks,
> Christian


I doubt it.  A data.frame is a specific subset of a
list.  You should be able to do anything you want with
a list.  Have a look at the Lists and Dataframes
chapter of Intro to R.

______________________________________________
[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
and provide commented, minimal, self-contained, reproducible code.

Reply via email to