Hi,
When x is a data frame, sample(x) is not really sensible :
R> sample(iris) # sends back all the iris data set.
What about a generic sample function (from R-devel/src/library/base/R)
with a method for class `data.frame` that would sample the row indexes
and then do the subset. See the code
Hi,
Does anyone know how I can retrieve a function name, for example
If I have a function f as follows:
f <- function( myfunc ) {
print( name_of(myfunc) );
}
I want to know what I should have as "name_of" such that I could call this
with :
f( median )
and it would print "media
probably you're looking for:
f <- function(FUN, x){
list(funName = deparse(substitute(FUN)), value = FUN(x))
}
f(mean, rnorm(10))
f(median, rnorm(10))
I hope it helps.
Best,
Dimitris
Dimitris Rizopoulos
Ph.D. Student
Biostatistical Centre
School of Public Health
Catholic University o
"Tom McCallum" <[EMAIL PROTECTED]> writes:
> Hi,
>
> Does anyone know how I can retrieve a function name, for example
>
> If I have a function f as follows:
>
> f <- function( myfunc ) {
> print( name_of(myfunc) );
> }
>
> I want to know what I should have as "name_of" such that I could
On Wed, 8 Nov 2006, Vladimir Dergachev wrote:
> On Wednesday 08 November 2006 12:56 pm, Luke Tierney wrote:
>> On Mon, 6 Nov 2006, Vladimir Dergachev wrote:
>>> Hi Luke,
>>>
>>>
>>> I generally agree with this, however I believe that current logic breaks
>>> down for large allocation sizes and my
On Thursday 09 November 2006 12:21 pm, Luke Tierney wrote:
> On Wed, 8 Nov 2006, Vladimir Dergachev wrote:
> > On Wednesday 08 November 2006 12:56 pm, Luke Tierney wrote:
> >> On Mon, 6 Nov 2006, Vladimir Dergachev wrote:
> >
> > Hi Luke,
> >
> > Yes, I gladly concede the point that for a heurist
Hi everyone,
Firstly, I'm sorry for the cross-post. I re-read the posting guide
and it appears my question is more related to r-devel (i think :-) )
I downloaded the source code available at:
http://cran.fhcrc.org/src/base/R-2/R-2.4.0.tar.gz
to a linux machine (Linux 2.6.11-1.1369_FC4smp
Benilton Carvalho <[EMAIL PROTECTED]> writes:
> Hi everyone,
>
> Firstly, I'm sorry for the cross-post. I re-read the posting guide
> and it appears my question is more related to r-devel (i think :-) )
>
> I downloaded the source code available at:
>
> http://cran.fhcrc.org/src/base/R-2/
Hello,
What about an `invert` argument in grep, to return elements that are
*not* matching a regular expression :
R> grep("pink", colors(), invert = TRUE, value = TRUE)
would essentially return the same as :
R> colors() [ - grep("pink", colors()) ]
I'm attaching the files that I modified (