search for: extract1

Displaying 1 result from an estimated 1 matches for "extract1".

Did you mean: extract
2003 Jul 23
1
Passing references to data objects into R functions
...e further manipulations on the extract and then returns the result. The function takes the data object's name and an index vector -- for example the following call would return the first 3 rows of object data1. ans = extract("data1", 1:3) I could write a simple function like this: extract1 = function(object.name, index) { temp = get(object.name, envir = .GlobalEnv) temp = temp[index, , drop=FALSE] # do some further manipulations here .... return(temp) } The problem is that the function makes a copy "temp" of the object in the function frame, which (in m...