Displaying 2 results from an estimated 2 matches for "var2_lab".
Did you mean:
var1_lab
2008 Feb 26
2
Combining series of variables using identifier
...t;, "A50", "B60"), each=5),
var1_lab= rep(c("cat", "dog", "mouse", "horse"), each=5),
var2 = rep(c("B20", "X40", "D50", "G60"), each=5),
var2_lab= rep(c("car", "bicycle", "train", "bus"), each=5))
str(a)
I'd like to create new variables by combining "varX" and "varX_lab" like this:
a$var1_new <- factor(paste(a$var1, a$var1_lab, sep=": "))
a$var2_new <- factor(p...
2008 Feb 29
1
How to export tables in list separately using write.table or sink?
...t;, "A50", "B60"), each=5),
var1_lab= rep(c("cat", "dog", "mouse", "horse"), each=5),
var2 = rep(c("B20", "X40", "D50", "G60"), each=5),
var2_lab= rep(c("car", "bicycle", "train", "bus"), each=5))
g <- unlist(lapply(a, is.factor))
g <- a[g]
g.tablist <- lapply(g, function(x) table(x, g$var1))
for (i in g.tablist) write.table(i , paste(Sys.Date(), i, sep=""))
Warning messages:
1: I...