hits <- vapply(titles,
FUN = grepl,
FUN.VALUE = logical(length(pass_names)),
pass_names)
titles is a vector with titles such as "mr", pass_names is a list of names.
2 questions.
- I don't understand the resulting matrix hits
- I don't understand why the last line is
pass_namesnor what how I am supposed to know about these 4 arguments. Under?vapplyit specificies the x,FUN,FUN.VALUEbut I cannot figure out how I am supposed to figure out thatpass_namesneeds to be listed there.
I have looked online and could not find an answer, so I hope this will help others too. Thank you in advance for your answers, yes I am a beginner.
Extra info: This question uses the titanic package in R, pass_names is just titanic$Name, titles is just paste(",", c("Mr\\.", "Master", "Don", "Rev", "Dr\\.", "Major", "Sir", "Col", "Capt", "Jonkheer"))