Re: [R] how to extract options for a function call

2011-04-18 Thread fisken
thanks 2011/4/18 S Ellison : > > >>>> fisken 18/04/2011 14:56:56 >>> >>But what I want, >>is to extract the options associated with a parameter for a function. > > Try > ?formals > > S Ellison > >

[R] how to extract options for a function call

2011-04-18 Thread fisken
Hi, I'm having some difficulties formulating this question. But what I want, is to extract the options associated with a parameter for a function. e.g. method = c("Nelder-Mead", "BFGS", "CG", "L-BFGS-B", "SANN") in the optim function. So I would like to have a vector with c("Nelder-Mead", "BFGS"

[R] force output dimension of table function

2011-04-06 Thread fisken
I have a small annoying problem. When I use the 'table' function on a simple vector it counts the number of occurences. So depending on the values of my input vector the function returns a class of type table with different lengths. Is there an easy way to tell the table function, the values to e

Re: [R] run function on subsets of matrix

2011-03-28 Thread fisken
gt; >>> On Mar 26, 2011, at 10:26 PM, fisken wrote: >>> >>>> I was wondering if it is possible to do the following in a smarter way. >>>> >>>> I want get the mean value across the columns of a matrix, but I want >> >> _along_ the columns, I

[R] run function on subsets of matrix

2011-03-26 Thread fisken
I was wondering if it is possible to do the following in a smarter way. I want get the mean value across the columns of a matrix, but I want to do this on subrows of the matrix, given by some vector(same length as the the number of rows). Something like nObs<- 6 nDim <- 4 m <- matrix(rnorm(

Re: [R] get a vector with filenames with a certain extension in a folder

2009-07-18 Thread torpedo fisken
ot;txt". > > pattern=glob2rx("*.txt") > > is more likely to do what you want. > > >> good luck, >> >> milton >> brazil=toronto >> >> On Fri, Jul 17, 2009 at 12:08 AM, torpedo fisken >> wrote: >> >>> Hi >>

[R] get a vector with filenames with a certain extension in a folder

2009-07-16 Thread torpedo fisken
Hi I got a script that works on file with the extension ".qed" that are al located in a folder '~/works/' Is there are R function that will fetch all the filenames from the works subdir, similar to 'ls ~/works/*.qed' Thanks in advance __ R-help@r-proj

Re: [R] Count the number of occurences in ranges

2009-07-16 Thread torpedo fisken
> > temp <- cut(probs,breaks=seq(0,1,length=51)) > print(temp) > > do.call(rbind,lapply(split(probs,temp),sum)) > > > > On Jul 15, 2009, torpedo fisken wrote: > > I got a vector of probabilities like, > probs<-c(0.001,0.5,0.02,1,.) > > Is th

[R] Count the number of occurences in ranges

2009-07-15 Thread torpedo fisken
I got a vector of probabilities like, probs<-c(0.001,0.5,0.02,1,.) Is there any nice and easy builtin function to get the number of occurences within some specified probabality range. Like with 2% it would be occur[1] = sum(probs[probs>0&probs<0.02]) occur[2] = sum(probs[probs>0.02&probs<0.04