search for: coercion

Displaying 20 results from an estimated 812 matches for "coercion".

2015 Apr 14
3
behavior of as.integer("5000000000")
On 04/13/2015 11:32 PM, Martin Maechler wrote: > >> Hi, >> > as.integer("5000000000") >> [1] 2147483647 >> Warning message: >> inaccurate integer conversion in coercion > >> > as.integer("-5000000000") >> [1] NA >> Warning message: >> inaccurate integer conversion in coercion > >> Is this a bug or a feature? The man page suggests it's the >> latter: > > I think you mean the "form...
2015 Apr 14
3
behavior of as.integer("5000000000")
Hi, > as.integer("5000000000") [1] 2147483647 Warning message: inaccurate integer conversion in coercion > as.integer("-5000000000") [1] NA Warning message: inaccurate integer conversion in coercion Is this a bug or a feature? The man page suggests it's the latter: ?as.integer? attempts to coerce its argument to be of integer type. The answer will be ?NA? unless...
2015 Apr 17
1
behavior of as.integer("5000000000")
...rites: >> On 04/13/2015 11:32 PM, Martin Maechler wrote: >>> >>>> Hi, >>>> > as.integer("5000000000") >>>> [1] 2147483647 >>>> Warning message: >>>> inaccurate integer conversion in coercion >>> >>>> > as.integer("-5000000000") >>>> [1] NA >>>> Warning message: >>>> inaccurate integer conversion in coercion >>> >>>> Is this a bug or a feature? The man page suggests i...
2015 Apr 17
0
behavior of as.integer("5000000000")
...13 Apr 2015 23:36:14 -0700 writes: > On 04/13/2015 11:32 PM, Martin Maechler wrote: >> >>> Hi, >>> > as.integer("5000000000") >>> [1] 2147483647 >>> Warning message: >>> inaccurate integer conversion in coercion >> >>> > as.integer("-5000000000") >>> [1] NA >>> Warning message: >>> inaccurate integer conversion in coercion >> >>> Is this a bug or a feature? The man page suggests it's the >>>...
2011 Feb 14
2
How to get warning about implicit factor to integer coercion?
Is there a way in R (12.x) to avoid the implicit coercion of factors to integers in the context of subscripts? If this is not possible, is there a way to get at least a warning, if any coercion of this type happens, given that the action of this coercion is almost never what is wanted? Of course, in the rare case that as.integer() is applied explicitly...
2011 Apr 26
1
Hook into Coercion Framework for data.frame
Hi, I am looking into a way to hook into the R coercion framework to allow me to convert table-like data stored within a COM object into a data.frame. Some of our COM objects have their own table-like data storage, and from R's point of view it's an object (EXTPTRSXP) decoarated with a sepcial symbol so we can easily identify it. COM_Table &l...
2020 Oct 07
2
Coercion function does not work for the ALTREP object
Hi all, The coercion function defined for the ALTREP object will not be called by R when an assignment operation implicitly introduces coercion for a large ALTREP object. For example, If I create a vector of length 10, the ALTREP coercion function seems to work fine. ``` > x <- 1:10 > y <- wrap_altrep(x) &...
2005 Nov 14
2
Coercion of percentages by as.numeric
Hi Given that things like the following work > a <- c("-.1"," 2.7 ","B") > a [1] "-.1" " 2.7 " "B" > as.numeric(a) [1] -0.1 2.7 NA Warning message: NAs introduced by coercion > I naively expected that the following would behave differently. > b <- c('10%', '-20%', '30.0%', '.40%') > b [1] "10%" "-20%" "30.0%" ".40%" > as.numeric(b) [1] NA NA NA NA Warning message: NAs introd...
2011 Apr 20
2
coercion
Dear ALL I don't know why I can see this error in run this sentences. In paste("V", 1L:cols, sep = "") : NAs introduced by coercion DATA<-read.delim ("D:\\DATA\\GeneExpression.txt",header=FALSE) I will be glad if you help me. Best Regards, Stat Consult [[alternative HTML version deleted]]
2012 Jun 07
1
factor coercion with read.csv or read.table
How do I fix this error ? I tried coercion to a vector but that didn't work. msci <-read.csv("..MSCIexUS.csv", header=TRUE) head(msci) Date index 1 Dec 31, 1969 100 2 Jan 30, 1970 97.655 3 Feb 27, 1970 96.154 4 Mar 31, 1970 95.857 5 Apr 30, 1970 85.564 6 May 29, 1970 79.005 > str(msci) 'data.frame...
2007 May 02
2
NAs introduced by coercion in dist()
I work with Windows and use R version 2.4.1. I am JUST starting to learn this program... I get this warning message 'NAs introduced by coercion' while trying to build a distance matrix (to be analyzed with NMDS later) from a 336 x 100 data matrix. The original matrix has lots of zeros and no missing values, but I don't think this should matter. I searched this forum and people have suggested that the warning should be ignored but...
2020 Aug 23
2
sum() vs cumsum() implicit type coercion
...0.0129 -0.0152 -0.0494 -0.0739 -0.0761 -0.0758 -0.0759 [10] -0.0763 -0.0799 -0.0809 -0.0820 -0.0832 -0.0838 -0.0822 -0.0816 Which I guess is due to the following line in do_cum(): PROTECT(t = coerceVector(CAR(args), REALSXP)); This might be fine and there may be very good reasons why there is no coercion in sum - just seems a little inconsistent in usage Cheers -- Rory
2020 Oct 08
1
Coercion function does not work for the ALTREP object
...20 at 5:04 AM Gabriel Becker <gabembecker at gmail.com> wrote: > Jiefei, > > Where does the code for your altrep class live? > > Thanks, > ~G > > On Wed, Oct 7, 2020 at 4:25 AM Jiefei Wang <szwjf08 at gmail.com> wrote: > >> Hi all, >> >> The coercion function defined for the ALTREP object will not be called by >> R >> when an assignment operation implicitly introduces coercion for a large >> ALTREP object. >> >> For example, If I create a vector of length 10, the ALTREP coercion >> function seems to work fine...
2011 Jul 29
2
converting factor to numeric gives "NAs introduced by coercion"
...both characters and numbers. I tried to convert some of the columns from factor to numeric and as I understood it you can not use only as.numeric but as.character first. I got this warning message: > skogTemp_1 <- as.numeric(as.character(skogTemp_1[,2:4])) Warning message: NAs introduced by coercion I have lots of NAs in my data. Tries to check what class I had now but another warning is given me: > class(skogTemp_1[,2]) Error in skogTemp_1[, 2] : incorrect number of dimensions > class(skogTemp_1[1,2]) Error in skogTemp_1[1, 2] : incorrect number of dimensions frustrating... I don'...
2020 Nov 21
3
Two ALTREP questions
...return(R_NilValue); ') x <- 1:6 attachAttrib(x, pairlist(dim = c(2L, 3L))) .Internal(inspect(x)) ``` Since the matrix, or adding attributes, is a common need for the object operation, I wonder if this missing feature is intended? This also brings my second question, it seems like the ALTREP coercion function does not handle attributes correctly. After the coercion, the ALTREP object will lose its attributes. ``` coerceFunc <- inline::cxxfunction( signature(x = "SEXP", attr = "SEXP" ) , ' SET_ATTRIB(x,attr); return(Rf_coerceVector(x, REALSXP)); ') > coerceFunc...
2011 Feb 02
2
automatic coercion to character
Hi R users I am wondering how I can avoid automatic coercion of my numeric vector elements to character init <- c(age='N', R=as.numeric(0.5), S=as.numeric(0.8)) I have used as.numeric() but it does not seem to work Thank you Lorenzo [[alternative HTML version deleted]]
2012 Apr 29
1
Error in if (nuhat < 2) stop("The degrees of freedom must be greater than or equal to 2") : missing value where TRUE/FALSE needed
...2") : missing value where TRUE/FALSE needed In addition: Warning messages: 1: In min(sub[vecn >= 12]) : no non-missing arguments to min; returning Inf 2: In max(sub[vecn >= 12]) : no non-missing arguments to max; returning -Inf 3: In near(x1, x1[isub[i]], fr1) : NAs introduced by coercion 4: In near(x2, x1[isub[i]], fr2) : NAs introduced by coercion 5: NAs introduced by coercion > ancboot(covGrp1, dvGrp1, covGrp2, dvGrp2, nboot = 2000) [1] "Note: confidence intervals are adjusted to control FWE" [1] "But p-values are not adjusted to control FWE" [1] "Ta...
2020 Aug 25
1
sum() vs cumsum() implicit type coercion
...0.0809 -0.0820 -0.0832 -0.0838 -0.0822 -0.0816 >> >> Which I guess is due to the following line in do_cum(): >> >> PROTECT(t = coerceVector(CAR(args), REALSXP)); >> This might be fine and there may be very good reasons why there is no >> coercion in sum - just seems a little inconsistent in usage > Yes. I don't know the reason for this design, but please note it is > documented in ?sum and in ?cumsum, which would also make it harder to > change. One can always use a consistent subset (not rely on the coercion...
2018 Jan 27
1
R (>= 3.4.0): integer-to-double coercion in comparisons no longer done (a good thing)
...lt;- integer(1000) > y <- double(1000) > profmem::profmem(z <- (x < y)) Rprofmem memory profiling of: z <- (x < y) Memory allocations: bytes calls 1 4040 <internal> total 4040 Note how in R (<= 3.3.3), the (x < y) comparison will cause an internal coercion of integer vector 'x' into a double, which then can be compared to double 'y'. In R (>= 3.4.0), it appears that this coercion is done per element and will therefore avoid introducing a new, temporary copy internally. The same is observed with when comparing with (x == y). This...
2018 Jan 30
2
as.list method for by Objects
...documentation is not particularly clear about what as.list() > means for list derivatives. IMO clarifications should stick to > simple concepts and formulations like "is.list(x) is TRUE" or > "x is a list or a list derivative" rather than "x is a VECSXP". > Coercion is useful beyond the use case of implementing a .C entry > point and calling as.numeric/as.list/etc... on its arguments. > > This is why I was hoping that we could maybe discuss the possibility > of making the as.list() contract less vague than just "as.list() > must return a li...