[R] appending variable's values in table like fashion

David Winsemius dwinsemius at comcast.net
Mon Feb 6 16:49:05 CET 2012


On Feb 6, 2012, at 6:29 AM, sagarnikam123 wrote:

> i have two variable
>> pyar
> [1] "M"  "12" "34" "13"
>> gita
> [1] "U"  "22" "33" "44"
> want to append gita object below pyar object as
> & want to take in anther variable
>

You could make a character matrix:

cmat <- matrix(c(pyar,gita), nrow=2, byrow=T)


> "M"  "12" "34" "13"
> "U"  "22" "33" "44"
>
> & write it in table fashion inside file

write.table(cmat, row.names=F, col.names=F)
"M" "12" "34" "13"
"U" "22" "33" "44"

-- 

David Winsemius, MD
West Hartford, CT



More information about the R-help mailing list