similar to: suggestion for extending ?as.factor

Displaying 20 results from an estimated 10000 matches similar to: "suggestion for extending ?as.factor"

2009 May 23
2
as.numeric(levels(factor(x))) may be a decreasing sequence
Function factor() in the current development version (2009-05-22) guarantees that levels are different character strings. However, they may represent the same decimal number. The following example is derived from a posting by Stavros Macrakis in thread "Match .3 in a sequence" in March nums <- 0.3 + 2e-16 * c(-2,-1,1,2) f <- factor(nums) levels(f) # [1]
2009 May 25
2
inconsistency in ?factor
In the almost current development version (2009-05-22 r48594) and also in https://svn.r-project.org/R/trunk/src/library/base/man/factor.Rd ?factor contains (compare the formulations marked by ^^^^^^) \section{Warning}{ The interpretation of a factor depends on both the codes and the \code{"levels"} attribute. Be careful only to compare factors with the same set of levels (in
2009 Dec 15
3
RFC: lchoose() vs lfactorial() etc
lgamma(x) and lfactorial(x) are defined to return ln|Gamma(x)| {= log(abs(gamma(x)))} or ln|Gamma(x+1)| respectively. Unfortunately, we haven't chosen the analogous definition for lchoose(). So, currently > lchoose(1/2, 1:10) [1] -0.6931472 -2.0794415 NaN -3.2425924 NaN -3.8869494 [7] NaN -4.3357508 NaN -4.6805913 Warning message: In
2006 Oct 11
2
expression as a parameter of binom.test (PR#9288)
Full_Name: Petr Savicky Version: 2.4.0 OS: Fedora Core release 2 Submission from: (NULL) (62.24.91.47) the error is > binom.test(0.56*10000,10000) Error in binom.test(0.56 * 10000, 10000) : 'x' must be nonnegative and integer while > binom.test(5600,10000) yields correct result. The same error occurrs for > binom.test(0.57*10000,10000)
2002 Jun 20
1
tree construction crashes (PR#1698)
Full_Name: Petr Savicky Version: 1.5.0 OS: SuSE 7.2 Submission from: (NULL) (147.231.6.1) The function tree() from the tree package crashes for certain input data. All the information needed to reproduce the error (data, script, expected error message) may be found at http://www.cs.cas.cz/~savicky/tree_error/tree_error.tgz Exactly the same error appeared at another computer running some RedHat
2012 Mar 08
4
Correlation between 2 matrices but with subset of variables
Dear All, I have two matrices A (40 x 732) and B (40 x 1230) and would like to calculate correlation between them.  I can use: cor(A,B, method="pearson") to calculate correlation between all possible pairs. But the issue is that there is one-many specific mappings between A and B and I just need to calculate correlations for those pairs (not all). Some variables in A (proteins, say p1)
2009 Dec 13
1
R CMD check may not detect a code/documentation mismatch
For the package at http://www.cs.cas.cz/~savicky/R-devel/something_0.0.0.tar.gz which is a minor part of some other package only to demonstrate the problem, i get (under R version 2.11.0 Under development 2009-12-12 r50714 and also under R-2.9.2, openSUSE 11.1 (x86_64) and CentOS release 5.2) R CMD check something_0.0.0.tar.gz ... * checking Rd files ... OK * checking Rd metadata ...
2008 Jun 06
2
Why doesn't formatC( x, digits=2, format="g") doesn't always give 2 sig figs?
Hi all I am not a C programmer, but I am trying to understand formatC to get consistent printing of reals to a given number of significant digits. Can someone please explain this to me? These first three give what I expect on reading ?formatC: > formatC(0.0059999, digits=2,format="fg",flag="#") [1] "0.0060" > formatC(0.59999,
2008 Jun 09
1
Bug/Error in formatC? (Was: Why doesn't formatC( x, digits=2, format= "g")...)
Hi all After posting what follows, Duncan Murdoch suggested perhaps a bug in formatC, or an error on documentation. Any comments? In particular, bug, error or not, any ideas about how I can consistently get two significant figures to print? P. ---------- Original Message ---------- Hi all I am not a C programmer, but I am trying to understand formatC to get consistent printing of
2012 Feb 16
2
help with e+01 number abbreviations
Dear List, I will appreciate any advice regarding how to convert the following numbers [I got in return by taxondive()] in numeric integers without the e.g. 6.4836e+01 abbreviations. Thank you very much in advance, Gian > taxa_dive Species Delta Delta* Lambda+ Delta+ S Delta+ Nat1 5.0000e+00 6.4836e+01 9.5412e+01 6.7753e+02 8.7398e+01 436.99 Nat2
2001 Oct 26
1
Bug or new concept in formatC?
As a sequel to my previous mail on cut, formatC does not produce what I have been taught is significant digits: > x <- c(1.0793,1.0796, 11.0954, 11.0736 ) > formatC(x,digits=3,format="g") [1] "1.08" "1.08" "11.1" "11.1" (3,3,3,3) significant digits OK > formatC(x,digits=3,format="f") [1] "1.079"
2007 Sep 03
3
When 1+2 != 3 (PR#9895)
Full_Name: Marco Vicentini, University of Verona Version: 2.4.1 & 2.5.1 OS: OsX & WinXP Submission from: (NULL) (157.27.253.46) When I proceed to test the following equation 1 + 2 == 3, I obviously obtain the value TRUE. But when I tryed to do the same using real number (i.e. 0.1 + 0.2 == 0.3) I obtained an unusual FALSE. In the online help there are some tricks for this problem. It
2007 Sep 26
1
modifying large R objects in place
I have a C function, which performs a transformation of a large integer matrix. The matrix may be of size 1.6GB, so I can have only one copy in RAM and have to modify it in place. This is possible using .Call and works fine. For debugging, I need two copies of a smaller matrix and modify only one of them. This may also be done, for example, by A <- some integer matrix B <- A +
2007 Apr 28
4
pure R code package for Windows
Dear R developers, I am using R under Linux, but I would like to share an extension package with some Windows users. The package contains only data and .R scripts. There is no src directory. So, I think I do not need a Windows machine with C compiler, "make", "sh" and "perl". If I am wrong, please tell me. I tried the following approaches (after verifying the
2011 Mar 26
3
round number
Hi, > a <- 4 > a*0.2 [1] 0.8 ok!! Is there a method to obtain this: > a*0.2 [1] 0.80 I need to round the number also with the zero. Thanks in advance, Alfredo
2009 Nov 11
1
Unexpected behaviour of seq(from,to,by) (PR#14057)
Full_Name: Raimon Massanet Version: 2.9.2 OS: Linux Ubuntu 8.10 Submission from: (NULL) (147.83.71.76) # Hi there. # I'm not sure whether or not this is a bug. # But it surely is an unexpected behaviour. V <- seq(from=0,to=1,by=0.1) # Should generate a sequence with a step of 0.1 V==0 # [1] TRUE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE # Ok! V==0.1 # [1] FALSE
2007 Jun 27
1
make check for 2.5.1 RC fails on mbcsToSbcs in graphics
configure and make run OK, but make check failed for R version 2.5.1 RC (2007-06-26 r42068) on graphics with error: > ## The following two examples use latin1 characters: these may not > ## appear correctly (or be omitted entirely). > plot(1:10, 1:10, main = "text(...) examples\n~~~~~~~~~~~~~~", + sub = "R is GNU ?, but not ? ...") Error in title(...) :
2012 Apr 03
3
Sweave xtable
Hola Tengo un problema con Sweave y xtable, concretamente quiero cambiar el color según un criterio, creo que es más fácil explicar con los siguientes ejemplos, uno puede correr directamente porque es R, al siguiente código hay que guardarlo como Rnw, y luego puede ser corrido en R, donde seguramente al correr este se darán cuenta de mis dos problemas porque saltan al abrir el pdf que se obtiene
2019 May 30
1
Possible bug in formatC
I do not know if this is a bug or a case of improper documentation. The documentation for formatC() implies that the difference between the options format="f" and format="g" is that with "g", scientific format is sometimes used. There is another difference between them that is not mentioned in the documentation. drop0trailing=FALSE is ignored when format is set to
2012 Feb 25
5
which is the fastest way to make data.frame out of a three-dimensional array?
foo <- rnorm(30*34*12) dim(foo) <- c(30, 34, 12) I want to make a data.frame out of this three-dimensional array. Each dimension will be a variabel (column) in the data.frame. I know how this can be done in a very slow way using for loops, like this: x <- rep(seq(from = 1, to = 30), 34) y <- as.vector(sapply(1:34, function(x) {rep(x, 30)})) month <- as.vector(sapply(1:12,