I am doing some computations, but am having a hard time wrining a program in r that accomplishes what I need.
x1<-c('a','b','c','d','a')
x2<-c('b','e','g')
x3<-c('c','a','h','j')
x4<-c('d','l','m','o','p','x','y','z')
x5<-c('f','q','a')
I am looking of a way to compute
y1<-length(intersect(x1,x2))
y2<-length(intersect(x3, union(x1,x2)))
y3<-length(intersect(x4, union(x3,union(x1,x2))))
y4<-length(intersect(x5, union(x4, union(x3,union(x1,x2)))))
Using the modified code from @Frank