similar to: Accessing the class of an object with two elements.

Displaying 20 results from an estimated 6000 matches similar to: "Accessing the class of an object with two elements."

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
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 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 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
2007 Dec 18
2
bug in r-base (PR#10521)
Full_Name: marco zamboni Version: no R version OS: ubuntu gusty Submission from: (NULL) (87.9.174.188) I have just finish to install gusty ubuntu on my AMD sempron. I would like to: $ sudo apt-get install r-base but ... I seguenti pacchetti hanno dipendenze non soddisfatte: r-base: Dipende: r-base-core (>= 2.6.1-1gutsy0) ma 2.5.1-1 sta per essere installato Dipende:
2007 Dec 18
2
bug in r-base (PR#10521)
Full_Name: marco zamboni Version: no R version OS: ubuntu gusty Submission from: (NULL) (87.9.174.188) I have just finish to install gusty ubuntu on my AMD sempron. I would like to: $ sudo apt-get install r-base but ... I seguenti pacchetti hanno dipendenze non soddisfatte: r-base: Dipende: r-base-core (>= 2.6.1-1gutsy0) ma 2.5.1-1 sta per essere installato Dipende:
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 Apr 12
4
HOW TO AVOID LOOPS
> Looking for a simple, effective a minimum execution time solution. > > For a vector as: > > c(0,0,1,0,1,1,1,0,0,1,1,0,1,0,1,1,1,1,1,1) > To transform it to the following vector without using any loops: > (0,0,1,0,1,2,3,0,0,1,2,0,1,0,1,2,3,4,5,6) > Appreciate any suggetions. [[alternative HTML version deleted]]
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'.
2007 Mar 13
2
An example of "overloading" [
Hello: Could anyone point me to a nice example where someone has created methods for "[" on a user defined Class? I looked at the package Matrix but that was a little daunting. I'm looking for someone a little more introductory. I've tried to search the help section and the web but its difficult since "[" isn't searchable. Thanks in advance! Greg [[alternative
2006 Sep 17
2
Building the call of an arbitrary function
Hy all, Is there a direct way to build the complete function call of an arbitrary function? Here's what I want to do. A function will build a function which will itself call a probability density function for some law given in argument to the first function: > f("gamma", 1000) will return, say, function(x, shape, rate, scale = 1/rate) dgamma(x + 1000, shape, rate,
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
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
2008 Mar 20
2
Installation of R, Sweave, ESS and [X]Emacs on Windows?
I'm trying to get R, Sweave, ESS and XEmacs or emacs all installed and working together on my Windows XP Pro system. I've got R 2.6.0 working just fine, installed from the R Windows installer. I also have CYGWIN_NT-5.1 with XEmacs 21.4 working okay. Can anyone point me to any documentation on how to bring these together so that R code typed in Xemacs can be run in R? I found the ESS
2008 Jan 22
2
MLE for censored distributions in R
Hi just wondering if there is a package that can get the maximum likelihood or method of moments estimator for distributions with censored data? The distributions I'm interested in are: Exponential, pareto, beta, gamma and lognormal. -- View this message in context: http://www.nabble.com/MLE-for-censored-distributions-in-R-tp15022863p15022863.html Sent from the R help mailing list archive at
2007 Feb 08
2
Newbie: Acf function
Hi, I would like to use acf.plot on a correlogram that is computed externally. In other words, I would like to "fake out" the acf object. Is this possible?-- any help would be appreciated. TIA Martin
2007 Feb 11
2
Extract NULL column in a matrix e.g. matrix[,-NULL]
Hello, I need to remove columns in a matrix. The number of columns varies from 0 to n. I can't figure out how to specify the zero case. aa <-matrix(runif(5^2),5,5) #remove column 3 aa[,-3] #remove no column aa[,-NULL] Error in -NULL : invalid argument to unary operator I know I could use ifelse, but it would complicate my model a lot. Is there a direct way to
2008 Aug 01
1
I install R in Ubuntu with apt-get, But I cannot see help.start() page.why
I install R in Ubuntu with apt-get,But I cannot see help.start() page.why Thanks [[alternative HTML version deleted]]