Monday 15 April 2013

Passing a missing argument in R -


I am writing a function in R, except for other things, reduce data frames based on the vector of column names I do [. Trying to take advantage of the default behavior of Data.frame , which is missing the 'J' argument, if all the columns will return. Is there any way to pass a missing debate through my cover function? Here is an example of a bare bone:

  fixdata frames & lt; - If I do not specify a value for the column, then I want it to be < Code> [ function: "error is missing in column logic, error is available, no default").   

You can set a default for columns such that if nothing is given then it Catch all the columns. TRUE should be used

  fixDataFrames & lt; - Function (listOfDataFrames, columns = TRUE) drop in the form of {lapply (listOfDataFrames, function (x) x [, columns])} # (parameterfixdataframes & lt; - function (listOfDataFrames, columns = TRUE, drop = FALSE) To add FALSE, more prudent {lapply (listOfDataFrames, function (x) x [, columns, drop = drop])}    

No comments:

Post a Comment