On Jun 22, 2012, at 5:09 PM, Joseph Boyer wrote:

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]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

David Winsemius, MD
West Hartford, CT

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to