search for: f5b02faa

Displaying 1 result from an estimated 1 matches for "f5b02faa".

2008 Apr 11
2
conditioning inside an lapply
This is probably basic but I want to condition based on the name of the component inside an lapply. So, in the simple example below, if .elem was x i want to do one thing but if it's y a different thing etc. Can someone tell me how to do that without using names(temp) as the thing one sends into the lapply ? Thanks. temp <- list(x=2,y=3,x=4) invisible(lapply(temp, function(.elem) {