Hi all,
let's say I have matrix
PeopleDescValue
Mary Height50
Mary Weight 100
FannyHeight 60
Fanny Height200
Is there a quick way to form the following matrix?
People HeightWeight
Mary 50 100
Fanny 60200
(Assuming I
If your original matrix is A then
unique(A$People) and unique(A$Desc)
will produce a vector of different people and a vector
of different descriptions.
--- yoo [EMAIL PROTECTED] wrote:
Hi all,
let's say I have matrix
PeopleDescValue
Mary Height50
Mary
Yea... let's say I constructed a matrix with rownames/colnames be those
unique elements.. then what should I do? I don't want to do mapply, etc to
find the field.. I'm wondering if there's a smarter way using row/col..
etc... Thanks!
Moshe Olshansky-2 wrote:
If your original matrix is A
Is this what you want?
x - PeopleDescValue
+ Mary Height50
+ Mary Weight 100
+ FannyHeight 60
+ Fanny Weight200
x - read.table(textConnection(x), header=TRUE, as.is=TRUE)
reshape(x, direction='wide', idvar=People, timevar=Desc)
People Value.Height