[R] question: how to select a column from a dataframe in a function

2012-01-13 Thread Julia Burggraaf
Hi, I am creating a function and ran into the problem of selecting a column from a dataset. It seems as though the $ function (as in data$columnname) does not apply in the function. In simplified version: This works: testf2<-function(data,columnnumber){print(data[,columnnumber])} But this doesn

[R] formula in function as text?

2012-01-17 Thread Julia Burggraaf
Hello all, It might be a simple question, but I cannot find the solution, as I do not know which subjects I should search on. So, much thanks for he/she we can help me. I am creating a function and would like to place a formula in the function, without it being executed immediately. Like saving it