Hi:
Hi:
Observe that if you quote the name of the variable in your original
function,
everything is fine; in fact, you can ask for multiple variables.
> k <- function(df, col) df[col]
> k(testdata, 'var1')
var1
1 0.91663902
2 0.60470753
3 0.09599891
> k(testdata, 'censor')
censor
1
Philipp Rappold wrote:
>
> Sorry guys, but I have another one:
>
>
> I want to write a function that returns a certain column of a
> dataframe. The function accepts two argument: the dataframe and the
> name of the column, but the column is not given as a "string" but as
> a variable name.
Sorry guys, but I have another one:
I want to write a function that returns a certain column of a
dataframe. The function accepts two argument: the dataframe and the
name of the column, but the column is not given as a "string" but as
a variable name.
EXAMPLE
--
> testd
3 matches
Mail list logo