Thank you Bert. It did indeed work and i put it in one line as well.
The match(TRUE..) through me off a little on the beginning, but i
realized why it's there.
Thanks for your continuous comments on mine and many other posts.
EK
On Sat, Apr 6, 2019 at 5:07 PM Bert Gunter wrote:
>
> I skipped pre
I skipped pre-populating MyDF$C as unnecessary:
> MyDF <- data.frame(A=c(1,2,3,4,5),B=c("aa ab ac","bb bc bd","cc
cf","dd","ee"),
+ stringsAsFactors = FALSE)
## I think this does what you want:
> choices<- sapply(MyDF$B, strsplit, split = " +")
> nm <- names(MyList)
> MyDF$C <- nm[sapply(choices
Thank you. Sorry i forgot to turn off the html
Below is a sample of my data. My original data frame has over 10,000 rows.
I want to check each element on my data frame column B
(MyDF$B) to see if it contains any element(s) of MYList. if os, change
the value of MyDF$C to the name of the vector of t
Hi All
Her is a sample of my data. A data frame (MyDF) and a list (MyList). My
own data frame has over 10,000 rows. I want to find out which elements of
MyDF$B contain any element(s) of MYList; then change MyDF$C to the name of
the vector of the list that has match.
I solved this via loops and i
4 matches
Mail list logo