rbind will work for data frames, but the type of your myData is not clear.
Is it a list of data frames, in which case you probably want
rbind(myData[[1]], myData[[2]])?  I don't understand why you write
NewData[1] for your desired result and not NewData.  Do you perhaps want
list(rbind(myData[[1]], myData[[2]])) for some particular reason?

Example:

myData <- list ( data.frame(a=1:2, b=12:13, c=14:15),
                         data.frame(a=3:4, b=14:15, c=16:17))

> rbind(myData[[1]],myData[[2]])
  a  b  c
1 1 12 14
2 2 13 15
3 3 14 16
4 4 15 17
>

Note:
> myData[1]        a slice of the myData list, itself a list (of length 1),
and equivalent to myData[1:1]
[[1]]
  a  b  c
1 1 12 14
2 2 13 15

> myData[[1]]     an *element* of the myData list, a data frame
  a  b  c
1 1 12 14
2 2 13 15
>

On Thu, Dec 31, 2009 at 1:09 AM, Steve Mew <steve....@alphaedge.org> wrote:

> I want to join two lists but am so for not having any luck. Can anyone
> assist ?
>
>
> Variable:      myData[1]
>
> "Data.Id"    "Data.Length"     "Data.Weight"
> "1"        12            12
> "2"        45            23
>
>
>
> Variable:      myData[2]
>
> "Data.Id"    "Data.Length"     "Data.Weight"
> "3"        25            56
> "4"        55            288
>
>
> How do I join them together to get this ?  ;
>
>
> Variable:      NewData[1]
>
> "Data.Id"    "Data.Length"     "Data.Weight"
> "1"        12            12
> "2"        45            23
> "3"        25            56
> "4"        55            288
>
>
> I have tried rbind,cbind,append, merge no luck so far...
> Any help greatly appreciated...
>
> Thanks
>
> Steve
>
>        [[alternative HTML version deleted]]
>
> ______________________________________________
> R-devel@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>

        [[alternative HTML version deleted]]

______________________________________________
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel

Reply via email to