Why doesn't this work?

                #Drop a variable name from a data frame

DropLikeSAS <- function(x,df) {

                                df[[x]] <- NULL

                                0

                                }

DropLikeSAS("VarName", DataFrameName)


Try it. The column VarName will not be deleted from the data frame DataFrameName.


But

x <- "VarName"
DataFrameName[[x]] <- NULL

Works.



	[[alternative HTML version deleted]]

