If d is the input data frame create a function f(x, v) which returns a 1 for each element of x in vector v and 0 for the other elements. Then cbind d[1] to the indicated expression. No packages are used. f<-function(x,v)+apply(x,2,`%in%`,v)cbind(d[1],c(f(d[1],1:...
do.callis often used withrbindandcbind, as it is used to assemble lists into simpler structures. Its input is a function and it applies its other arguments to the function. Examples: For the data frame below: df <- data.frame(names = c("SAM","ROB","MAX"), grade = rep(LETTERS[1:...