Displaying 3 results from an estimated 3 matches for "bigfunction".
2011 Feb 17
1
calling pairs of variables into a function
Hi,
I have imported three text files into R using read.table. Their variables
are called d, e and f.
I want to run a function on all the possible combinations of these three
files. The only way I know how to do that is like this:
bigfunction(d,e)
bigfunction(d,f)
bigfunction(e,d)
bigfunction(e,f)
bigfunction(f,e)
bigfunction(f,d)
Is there an easier way? I will have five files later on, so it would be
useful to know! I'd imagine I can use a loop somehow, and I have installed
a package (gregmisc) so that typing permutations(3,2)...
2011 Oct 28
3
program never enters browser mode when I add browser()
Dear All
I have a program that breaks at the following lines of code:
bigfunction =
{
...
object1 = myfunction(x)
object2 = strsplit(object1, ",")[[1]]
...
}
where myfunction is defined elsewhere outside of bigfunction.
The error I get is "error in strsplit() -- object1 not found".
However, when I insert browser() into my code so that the above reads,...
2009 Mar 23
1
Confusion regarding environments invoked by "source" command
Colleagues,
R version 2.8.1 in OS X
Within a function (which is already within a function), I am sourcing
a file. The syntax of the command is something like (this is just an
example; the actual code is much more complicated):
BIGFUNCTION <- function()
{
DATAFRAME <- [some commands to create a dataframe]
MYFUNCTION(DATAFRAME)
}
MYFUNCTION <- function(DATAFRAME)
{
print(ls())
exists("DATAFRAME")
source("myfile", local=T)
}
The file "myfile" contains the following:
print(DATAFRAME)
Wh...