Displaying 20 results from an estimated 5000 matches similar to: "Building the call of an arbitrary function"
2006 Jan 31
2
Announce: Contributed Documentation
[Version fran??aise plus bas]
To the R community,
A quick word to announce the publication of my document "Introduction
?? la programmation en S". It is available in the French section of the
Contributed Documentation page of CRAN.
Many of the documents or books currently available on S-Plus and/or R
present the software in a statistical analysis context. My document
rather focuses
2005 Apr 20
1
Negative argument for head() and tail()
Dear R developers,
I'm a former APL programmer. In that language, the "take" (up arrow) and
"drop" (down arrow) operators were extensively used to, well, take and drop
elements of vectors. Functions head() and tail() are equivalents in R for the
"take" operator, but nothing seems to mimic the "drop" operator. I think it
would be useful.
For
2006 Jul 05
2
Compilation of R packages
Le Mercredi 5 Juillet 2006 09:41, Dirk Eddelbuettel a ?crit?:
> Salut Vincent,
>
> On 4 July 2006 at 23:27, Vincent Goulet wrote:
> | I'm currently following your procedure suggested on R-SIG-Debian
> | (https://stat.ethz.ch/pipermail/r-sig-debian/2006-June/000095.html) to
> | compile and install the latest version of R on Kubuntu. It is my
> | understanding that I
2005 Aug 29
5
Testing if all elements are equal in a vector/matrix
Is there a canonical way to check if all elements of a vector or matrix are
the same? Solutions below work, but look hackish to me.
> x <- rep(1, 10)
> all(x == x[1]) # == operator does not provide for small differences
[1] TRUE
> isTRUE(all.equal(x, rep(x[1], length(x)))) # ugly
[1] TRUE
Best,
Vincent
--
Vincent Goulet, Associate Professor
??cole d'actuariat
2006 Sep 27
1
S3 methods for cbind/rbind
I created a type of object similar to a data frame. In some circumstances, It
needs special methods for "[" and "[<-" and rbind() (but not cbind()). Then I
found this in the cbind()/rbind() man page:
The method dispatching is _not_ done via 'UseMethod()', but by
C-internal dispatching. Therefore, there is no need for, e.g.,
'rbind.default'.
2010 May 31
1
Suggested tidying up
Package grDevices has a function cm() to convert from inches to centimeters. Its definition is:
cm <- function(x) 2.54*x
As far as I can tell, the function is not used anywhere in the R sources (I grepped for "cm(", "cm)" and ", cm".) I did not check for all packages on CRAN, though.
May I propose to remove this apparently useless function from the sources?
[I
2005 Sep 07
1
Avoid Sweave from stopping on errors
Hi all,
Is there an option in Sweave to avoid it from stopping on a code chunk with an
error? (I purposefully want to include code with an error in class notes.)
I suspect the answer is "no" and that I will be pointed to options("error").
That'd be fine, but which error parameter will just "do nothing" in case of
an error?
Thanks in advance!
--
Vincent
2008 Feb 14
1
Small encoding question
Dear developeRs,
Compilation of the latest version (0.9-5) of my actuar package fails
with r-release MacOS_X ix86 on CRAN; see
http://www.R-project.org/nosvn/R.check/r-release-macosx-ix86/actuar-00check.html
All errors come from accented letters in comments in latin-1 encoded
files (except hierarc.R which is in UTF-8, my bad). Encoding is
declared as latin-1 in DESCRIPTION.
The package
2009 Jun 16
1
Testing if all elements are equal in a vector/matrix
Hi All,
There are several replies to the question below, but I think there must
exist a better way of doing so.
I just want to check whether all the elements of a vector are same. My
vector has one million elements and it is highly likely that there are
distinct elements in the first few itself. For example:
> x = c(1,2,rep(1,100000))
I want the answer as FALSE, which is clear from the
2008 May 02
2
Out of bounds negative index
Hi,
From the R Language Definition, Section 3.4.1:
"If i is positive and exceeds length(x) then the corresponding
selection is NA. A negative out of bounds value for i causes an error."
(This is also mentioned in S Programming, footnote of page 24.)
Can someone please provide an example triggering the error? Looking in
src/main/subscript.c I could not find exception handling for
2006 Jul 17
1
Patch to allow negative argument in head() and tail()
Dear developeRs (and other abuseRs ;-),
I would like to contribute a patch against functions head() and tail() of
package utils to allow for a negative 'n' argument. This allows to extract
all but the first/last 'n' elements/rows/lines of an object, similar to
the "drop" operator of APL. [1]
I put the patched head.R and head.Rd files, along with diff files in
2005 Jul 20
2
Issues with convolve
We obtained some disturbing results from convolve() (inaccuracies and negative
probabilities). We'll try to make the context clear in as few lines as
possible...
Our function panjer() (code below) basically computes recursively the
probability mass function of a compound Poisson distribution. When the
Poisson parameter lambda is very large, the starting value of the recursive
scheme ---
2007 Jun 06
3
C function with unknown output length
Hi all,
Could anyone point me to one or more examples in the R sources of a C
function that is called without knowing in advance what will be the
length (say) of the output vector?
To make myself clearer, we have a C function that computes
probabilities until their sum gets "close enough" to 1. Hence, the
number of probabilities is not known in advance.
I would like to have an
2005 Oct 26
1
sweave/help
Hello list,
I would like to know if it is possible to get output of help(foo) with
Sweave.
If I insert ?foo in a chunk, the console give me the help but no output
is obtained in the tex file.
Perhaps something to do with options ?
Thanks in advance !
--
St??phane DRAY (dray at biomserv.univ-lyon1.fr )
Laboratoire BBE-CNRS-UMR-5558, Univ. C. Bernard - Lyon I
43, Bd du 11 Novembre 1918, 69622
2006 Oct 12
2
avoiding a loop?
I have a vector, (not a list)
> repeated.measures.FACTOR.names
[1] "Insp1" "Insp2" "Insp3" "Insp4" "Insp5" "Insp6" "Insp7" "Insp8" "Insp9"
and would like to convert this into a single string
"Insp1,Insp2,Insp3,Insp4,Insp5,Insp6,Insp7,Insp8,Insp9"
I can do that with a loop, but isn't there
2005 Feb 22
2
estimate the parameter of exponential distribution, etc.
Given a numeric vector of observations, does R have any generic way to estimate the parameters of commonly used distributions (exponential, gamma, etc.) without numerically optimizing the likelihood function?
Thanks,
David
_______________________________________
David R. Bickel http://davidbickel.com
Research Scientist
Pioneer Hi-Bred International
Bioinformatics & Exploratory Research
7250
2005 Oct 11
2
Sweave and Rnews
Hello list,
I am writing a paper for Rnews. I use Sweave to do it. I did not find
information about writing a paper for Rnews using Sweave and have some
questions:
- Is there a problem to use the environment 'Sinput' in the place of
'example' or 'smallexample'. It works fine but perhaps there are some
technical/editorial problems ?
- I have some long lines of code in
2005 Oct 25
3
making an inicator variable
Hello,
I am almost a total novice, and I am sure there must be an easy (and
basic) way to turn a variable of 1's and 2's into a variable of zeros
and ones. This is in a data frame, but if I could do it with vectors,
that's all I need.
Can someone tell me how?
Thanks so much,
Jen
2005 Sep 20
5
Add function to histogram?
Is there any neat way to add a curve (frequency function or the like) to a
histogram or other plots? I haven't found one yet...
Robert
2005 Feb 23
3
and [ESS] Starting ESS
Dear R People:
I have finally seen the error of my ways and have decided to use ESS for R
and S + stuff.
However, I have a question right from the beginning. I'm somewhat confused
by the installation instructions.
Do I install XEMACS or ESS first, please?
Windows XP
R Version 2.0.1
(S + 6.2)
Thanks so much!
Sincerely,
Laura Holt
mailto: lauraholt_983 at hotmail.com