[R] Help with functions
loyola9988 at yahoo.com
Wed Oct 22 17:53:48 CEST 2008
I have a the following function which takes a name(fname), total number of
rows (Total), number of times to make a sample(nSample), number of
records/rows to be included in each sample(nPatient). then it generates
required samples and calculates the mean and standard deviation of the
columns for each sample and finally in calculates the grand mean and
The problem is if I run each line of the code separately (not in a function)
it works but when I put it in a function it doesn't!!!
i.e. if I delete the first line, and put "Mydata"(where ever I have fname)
and 900(where ever I have Total) and 5 (where ever I have nSample) and 100
(where ever I have nPatient) and run each line separately it works fine. But
when I make a function like the one below and call it like:
I get this error message:
"Error in dimnames(x) <- dn : length of 'dimnames'  not equal to array
I used "debug" on the sampling function it seems the error comes from line
any idea why do I get this error and how to fix it?
colnames(trans) <- c(1:Total)
# load genefilter package
View this message in context: http://www.nabble.com/Help-with-functions-tp20113920p20113920.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help