[R] Data alignment

Petr PIKAL petr.pikal at precheza.cz
Mon Dec 5 11:44:27 CET 2011


> 
> Re: [R] Data alignment
> 
> Thanks for your suggestions. I will try them.
> 
> The "-" in my original post was actually only there to serve as a 
separator
> so that it is easier for you to see the data structure but apparently it
> rather confused you... sorry :)

That is why dput is to be used. Try this by yourself

> dput(y)
structure(c(2L, 1L, 1L, NA, 2L, 1L, NA, NA, 2L, NA, NA, NA, NA, 
1L, NA, NA, NA, 2L, NA, 1L, NA, 2L, NA, 3L, NA), .Dim = c(5L, 
5L), .Dimnames = list(NULL, c("", "BMW", "Mercedes", "VW", "Skoda"
)))

x<-structure(c(2L, 1L, 1L, NA, 2L, 1L, NA, NA, 2L, NA, NA, NA, NA, 
1L, NA, NA, NA, 2L, NA, 1L, NA, 2L, NA, 3L, NA), .Dim = c(5L, 
5L), .Dimnames = list(NULL, c("", "BMW", "Mercedes", "VW", "Skoda"
)))

> all.equal(x,y)
[1] TRUE
>

Regards
Petr




> 
> --
> View this message in context: http://r.789695.n4.nabble.com/Data-
> alignment-tp4153024p4153112.html
> Sent from the R help mailing list archive at Nabble.com.
> 
> ______________________________________________
> R-help at r-project.org 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.



More information about the R-help mailing list