On 12-06-22 5:09 PM, Joseph Boyer wrote:
Why doesn't this work?
David gave you a solution that works. The answer to this question is
that unlike SAS, R is a computing language that has an idea of variable
scoping: when you modify the argument df in DropLikeSAS, you are making
local changes
I think the OP might also be tripped up on the fact that R is
pass-by-value so effects on df inside DropLikeSAS won't have impact
outside the function's scope. The df inside of DropLikeSAS() is
changed as expected, but that has no effect on the df outside that
function.
To the OP: There are ways t
On Jun 22, 2012, at 5:09 PM, Joseph Boyer wrote:
DropLikeSAS <- function(x,df) {
df[[x]] <- NULL
0
}
DropLikeSAS("VarName", DataFrameName)
Sorry for the blank message>
> DropLikeSAS <- function(x
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("VarN
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
5 matches
Mail list logo