I've seen a solution for data frames which can definitely be applied in my case (just pop everything into a temporary data frame and do as the solution suggests, but does there exist a method just for vectors?
For example:
x = c('this', 'that', 'here', 'there')
data = c(0.1, 0.2, 0.5, 0.12)
categ = c('cat1', 'cat2', 'cat1', 'cat3')
So after having taken suggestions from comments, this is what I am trying to achieve. Let's take the data I present for example. I want to yield the vectors
cat1 = c(0.1,0.5)
cat2 = c(0.2)
cat3 = c(0.12)
I want the names to be x
and the levels to be categ
. The way I want to retrieve these vectors is subsetting my data. How do I achieve this?