Re: [R] get() within function

2016-08-18 Thread Ivan Calandra
Thank you Thomas, Because of the error message, I focused only on get()... My bad! Ivan -- Ivan Calandra, PhD Scientific Mediator University of Reims Champagne-Ardenne GEGENAA - EA 3795 CREA - 2 esplanade Roland Garros 51100 Reims, France +33(0)3 26 77 36 89 ivan.calan...@univ-reims.fr -- https

Re: [R] get() within function

2016-08-18 Thread Thomas Mailund
  Hi Ivan, ls() inside a function gives you the variables in the local scope. If you want to get the variables defined in the global scope you need to tell ls() that. Check the difference between these three functions: > foo <- function() ls() > foo() Returns character(0) because there are no

[R] get() within function

2016-08-18 Thread Ivan Calandra
Dear useRs, For an interactive use, I am trying to write a function that looks for all data.frames and lists in the environment and ask the user to select one of them. I then run some operations on this object. This is what I am trying: foo <- function(){ df.list <- ls()[sapply(ls(), fun