>
> 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... s
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 :)
--
View this message in context:
http://r.789695.n4.nabble.com/Data-a
try this:
> match(x$Name> x <- read.table(text = "Name - Value
+ A - 400
+ A - 300
+ B - 200
+ B - 350
+ C - 500
+ C - 350
+ D - 450
+ D - 600
+ E - 700
+ E - 750
+ F - 630
+ F - 650", header = TRUE, as.is = TRUE)
> map <- data.frame(key = c("A", "B", "C", "D", "E", "F")
+ , valu
I doubt your data frame looks like that, with all the -, but regardless you
can use ifelse() to construct your column.
Sarah
On Saturday, December 3, 2011, syrvn wrote:
> Hello!
>
> I have a data.frame which looks like:
>
> Name - Value
> A - 400
> A - 300
> B - 200
> B - 350
> C - 500
> C - 350
Hello!
I have a data.frame which looks like:
Name - Value
A - 400
A - 300
B - 200
B - 350
C - 500
C - 350
D - 450
D - 600
E - 700
E - 750
F - 630
F - 650
I want to add another column where all A,B should get an index 1, all C,D an
index of 2 and all E,F an index of 3 so that the data.frame loo
5 matches
Mail list logo