similar to: grep() and factors

Displaying 20 results from an estimated 10000 matches similar to: "grep() and factors"

2011 Sep 29
3
grep and PCRE fun
Hello, I think I've found a bug in the C function do_grep located in src/main/grep.c. It seems to affect both the latest revisions of R-2-13-branch and trunk when compiling R without optimizations and with it's own version of pcre located in src/extra, at least on ubuntu 10.04. According to the pcre_exec API (I presume the later versions), the ovecsize argument must be a multiple of 3 ,
1999 Jun 23
1
coercing factors to matrix() --> num/char ? -- inconsistencies|?
The old factor() wars...... {{maybe don't just report that factor()s are broken by design..}} If ff is a factor, e.g., ff <- as.factor(rep(1:2,3)) f2 <- ff; levels(f2) <- c("Lo","Hi") 1) we don't allow {in R as in S-plus 3.x} arithmetic on factors, i.e. 1 + ff gives an error, and I think most of us believe this is as desired. {{if one
2023 Nov 07
1
c(NA, 0+1i) not the same as c(as.complex(NA), 0+1i)?
Thanks Martin. My hang-up was not on what the outcome of as.complex(NA) should be, but rather, how I should read code like c(x, y) generally. Till now, I have thought of it like 'c(x, y)' is c(as(x, typeof(y)), y)` when "type(y) > type(x)". Basically in my mind, "coercion" in R <-> as.<newtype>(.) (or coerceVector() in C). So I tracked down the source
2023 Nov 05
2
c(NA, 0+1i) not the same as c(as.complex(NA), 0+1i)?
This is another follow-up to the thread from September "Recent changes to as.complex(NA_real_)". A test in data.table was broken by the changes for NA coercion to complex; the breakage essentially comes from c(NA, 0+1i) # vs c(as.complex(NA), 0+1i) The former is the output we tested against; the latter is essentially (via coerceVector() in C) what's generated by our
2023 Nov 06
1
c(NA, 0+1i) not the same as c(as.complex(NA), 0+1i)?
>>>>> Michael Chirico >>>>> on Sun, 5 Nov 2023 09:41:42 -0800 writes: > This is another follow-up to the thread from September > "Recent changes to as.complex(NA_real_)". > A test in data.table was broken by the changes for NA > coercion to complex; the breakage essentially comes from > c(NA, 0+1i) > # vs
2023 Nov 08
1
c(NA, 0+1i) not the same as c(as.complex(NA), 0+1i)?
So, to summarize, the open questions are: (1) Should as.complex(NA_character_) give complex(r=NA_real_, i=0) instead of NA_complex_? (2) Should the first argument in c(NA, x) and c(NA_integer_, x), where typeof(x) == "complex", be promoted to complex(r=NA_real_, i=0) instead of NA_complex_? My opinions: (1) No. The imaginary part of the
2023 Nov 09
1
c(NA, 0+1i) not the same as c(as.complex(NA), 0+1i)?
>>>>> Mikael Jagan >>>>> on Wed, 8 Nov 2023 11:13:18 -0500 writes: > So, to summarize, the open questions are: > (1) Should as.complex(NA_character_) give complex(r=NA_real_, i=0) > instead of NA_complex_? > (2) Should the first argument in c(NA, x) and c(NA_integer_, x), > where typeof(x) == "complex", be promoted
2005 Jan 31
3
type of list elements in .Call
[Forwarding to r-devel.] Dear People, Here is something I do not understand. Consider ************************************************* foo.cc ************************************************* #include <iostream> #include <R.h> #include <Rinternals.h> using std::cout; using std::endl; extern "C" { SEXP printlst(SEXP lst); } SEXP printlst(SEXP lst) { for(int
2005 Oct 28
1
Error in ?strsplit
Hi all, Came across an error in ?strsplit in the details section: Details: Arguments 'x' and 'split' will be coerced to character, so you will see uses with 'split = NULL' to mean 'split = character(0)', including in the examples below. I caught myself trying to use strsplit() on a factor and the coercion on 'x' is not done. According
2012 Aug 24
1
POSIXct-coerced NA's not considered NA by is.na()
Hello folks, I found a strangeness while experimenting with POSIXct vectors and lists. It seems that coerced NA's aren't "real" NAs, at least as considered by is.na()? > date_vec = c(as.POSIXct(now()), as.POSIXct(now()+1),NA,"b") > date_vec [1] "2012-08-22 15:00:46 COT" "2012-08-22 15:00:47 COT" NA [4] NA Warning message: In
2023 Nov 06
1
c(NA, 0+1i) not the same as c(as.complex(NA), 0+1i)?
Hmm, it is not actually at odds with help(c), it is just that the autocoercion works different that it used to, so that as.complex(NA) == as.complex(NA_real) == NA_real_+0i) which now differs from NA_complex although both print as NA. I haven't been quite alert when this change was discussed, but it does look a bit unfortunate that usage patterns like c(NA, 0+1i) does not give complex NA
2015 Mar 17
2
[LLVMdev] Alias analysis issue with structs on PPC
Hal Finkel <hfinkel at anl.gov> wrote on 16.03.2015 17:56:20: > If you want to do it at a clang level, the right thing to do is to > fixup the ABI lowerings for pointers to keep them pointers in this case. > So this is an artifact of the way that we pass structures, and > constructing a general solution at the ABI level might be tricky. > I've cc'd Uli, who did most
2020 Aug 25
1
sum() vs cumsum() implicit type coercion
>>>>> Tomas Kalibera >>>>> on Tue, 25 Aug 2020 09:29:05 +0200 writes: > On 8/23/20 5:02 PM, Rory Winston wrote: >> Hi >> >> I noticed a small inconsistency when using sum() vs cumsum() >> >> I have a char-based series >> >> > tryjpy$long >> >> [1]
2020 Aug 23
2
sum() vs cumsum() implicit type coercion
Hi I noticed a small inconsistency when using sum() vs cumsum() I have a char-based series > tryjpy$long [1] "0.0022" "-0.0002" "-0.0149" "-0.0023" "-0.0342" "-0.0245" "-0.0022" [8] "0.0003" "-0.0001" "-0.0004" "-0.0036" "-0.001" "-0.0011"
2012 Apr 13
3
How do I convert factors to numeric? It's an FAQ but...
Dear R list people I loaded a file of numbers into R and got a dataframe of factors. So I tried to convert it to numeric as per the FAQ using as.numeric(). But I'm getting errors (please see example), so what am I getting wrong? Thanks for your time. John Example... #my data object > f GSM187153 GSM187154 GSM187155 GSM187156 GSM187157 GSM187158 GSM187159 13 7.199346 7.394519
2017 Jun 28
1
regexec() bug in R 3.4.0
Hi, In R 3.4.0, the "Pattern Matching and Replacement" documentation that describes regexec(), gregexpr(), etc. states that the "text" argument to regexec is a character vector, "or an object which can be coerced by as.character to a character vector": regexec(pattern, text, ignore.case = FALSE, perl = FALSE, fixed = FALSE, useBytes = FALSE)
2007 Jul 05
1
cor() and cor.test() (PR#9781)
Hello, I am trying to make a correlation matrix in R using cor() and also to get the p-value for each correlation using cor.test(). I can't get these commands to work. I'm getting errors like the following: cor(Pollution, Wet.days) Error in inherits(x, "data.frame") : Object "Wet.days" not found cor("Pollution", "Wet.days") Error in
2013 Mar 09
1
Unexpected behavior looping through sequence of dates
I understand that the two following loops should produce the exact same output. However, they do not. It appears that looping directly through the sequence of Date objects somehow makes them be coerced to numeric: > date1 = "20130301" > date2 = "20130302" > > d1 = as.Date(date1, format="%Y%m%d", tz="GMT") > d2 = as.Date(date2,
2018 Jan 30
2
as.list method for by Objects
I just meant that the minimal contract for as.list() appears to be that it returns a VECSXP. To the user, we might say that is.list() will always return TRUE. I'm not sure we can expect consistency across methods beyond that, nor is it feasible at this point to match the semantics of the methods package. It deals in "class space" while as.list() deals in "typeof() space".
2017 May 23
2
Inconsistency in handling of numeric input with %d by sprintf
https://github.com/Rdatatable/data.table/issues/2171 The fix was easy, it's just surprising to see the behavior change almost on a whim. Just wanted to point it out in case this is unknown behavior, but Evan seems to have found this as well. On Tue, May 23, 2017 at 12:00 PM, Michael Chirico <michaelchirico4 at gmail.com > wrote: > Astute observation. And of course we should be