I am trying to use the stack
command on data loaded from two text csv files I want to compare. I want to use crossprod(table(stack(data)))
to see how many strings the different columns have in common (In the example it would be "dog" and "cat").
In this example the csv files contain columns with different numbers of strings.
> one<-read.delim("one.csv",sep="\t",header=F)
> two<-read.delim("two.csv",sep="\t",header=F)
> one
V1
1 dog
2 hamster
3 mouse
4 cat
> two
V1
1 dog
2 cat
3 rabbit
> data<-list(one,two)
> stack(data)
Error in stack.default(data) : at least one vector element is required
If I manually create lists with one<-c("dog",...)
it works. What am I doing wrong, and how can I do this right?