I have a table in a txt document. The table has column headings that look
like this: "1.a, 1.b, 1.c, 2.a, 2.b, 2.c"
I would like to import these data to R as 2 tables (1 and 2), each with
columns a, b, and c. I have seen this done before, but I cannot find the
commands to make it happen.
Thank
you can use combn to create the combinations and the following will
create a list of all the results:
x1 <- x2 <- x3 <- x4 <- 1:10
comb <- combn(c('x1','x2', 'x3', 'x4'), 2)
myTab <- lapply(seq(ncol(comb)), function(x){
table(get(comb[1, x]), get(comb[2, x]))
})
# put names of the combinations
Dear list,
I have a set of 100+ variables. I would like to have one by one crosstables for
each variable. I started with
table(variable1, variable2)
table(variable1, variable3)
table(variable1, variable4)
...
table(variable2, variable3)
table(variable2, variable4)
...
It seems rather tedious.
A
3 matches
Mail list logo