search for: aschar

Displaying 15 results from an estimated 15 matches for "aschar".

Did you mean: uschar
2007 Jul 23
1
CHAR(STRING_ELT( - OK but CHAR(asChar(STRING_ELT( - not, why?
Any idea why CHAR(asChar(STRING_ELT( produces NA whereas CHAR(STRING_ELT( gets a pointer to a string? It's generally expected that STRING_ELT should already be a character, but why the coercion does not work? Here is a simple example (consistent over R2.5.1-R2.6 rev 42284, I didn't check earlier versions, but it us...
2008 Aug 07
1
string comparison
Hi, I have a package where I do things like this a lot: if(strncmp(CHAR(asChar(Scategory)), "chance", 6) == 0) category = h_category_chance; else if(strncmp(CHAR(asChar(Scategory)), "utility", 7) == 0) category = h_category_utility; else if(strncmp(CHAR(asChar(Scategory)), "decision", 8) == 0) category = h_category_decision;...
2016 Sep 16
1
getGraphicsEvent() questions, minor feature/tweak request, and patch(es).
...After rooting about in the R source for a bit I've found a way to implement this change myself in src/main/gevents.c, and I've included a patch as attachment. What I don't know is if there's a better or at least more conventional way to be checking for the NA value. Coercing with asChar() and only comparing against R_NaString causes NULL values, functions, expression objects and potentially others to become valid prompt values as well, so I'm using TYPEOF() to restrict accepted values further. I've found manually entered NA values are interpreted as being of LGLSXP, so tha...
2007 Feb 20
5
Create a hyphen-separated set of letters derived from a string - How to?
Hi, This is such a trivial programming issue, but I can''t find a way to transform, say ''abc'' to ''a-b-c'' without using pattern matching. Any ideas? Thanks in Advance, Richard --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post
2009 Nov 15
2
Segmentation faults on SEXP conversion
Hello - I am making a first attempt at writing a simple C++ routine to print out R objects (this is a simple proof-of-concept as part of a larger package development). The relevant C++ routine is as follows: void Rwrite(SEXP fd, SEXP msg) { int *ofd = INTEGER(fd); const char * omsg = CHAR(asChar(msg)); printf("[%i] %s",*ofd,omsg); } And the corresponding interface in R is as follows: ptest <- function() { cfd <- as.integer(2); cmsg <- as.character("Hi"); storage.mode(cfd) <- "integer"; storage.mode(cmsg) <- "character&...
2016 May 24
2
Suggestion: mkString(NULL) should be NA
..._character_. In this light, mkString should arguably generate "". i don't think the fact that there is another way to get "" is a particularly large problem. On the other hand, and in support of your position it came up as Michael Lawrence and I were talking about this that asChar from utils.c will give you NA_STRING when you give it R_NilValue. That is a coercion though, whereas arguably mkString is not. That said, consistency would probably be good. ~G -- Gabriel Becker, PhD Associate Scientist (Bioinformatics) Genentech Research [[alternative HTML version deleted]]
2009 Jan 19
1
patch for textspecial and defaultfont in xfig
...asReal(CAR(args)); args = CDR(args); onefile = asLogical(CAR(args)); args = CDR(args); pagecentre = asLogical(CAR(args));args = CDR(args); + defaultfont = asLogical(CAR(args)); args = CDR(args); + textspecial = asLogical(CAR(args)); args = CDR(args); encoding = CHAR(asChar(CAR(args))); R_GE_checkVersionOrDie(R_GE_version); @@ -7476,7 +7487,7 @@ if (!(dev = (pDevDesc) calloc(1, sizeof(DevDesc)))) return 0; if(!XFigDeviceDriver(dev, file, paper, family, bg, fg, width, height, - (double) horizontal, ps, onefile, pagecentre, + (double) h...
2011 May 31
1
Coercing in R and in C (R-Extensions)
Hello, in "Writing R Extensions" I found the following stuff: "Note that these coercion functions are not the same as calling as.numeric (and so on) in R code, as they do not dispatch on the class of the object. Thus it is normally preferable to do the coercion in the calling R code." ( Writing R Extensions, 2011-04-13, page 100 ) What is meant by
2005 Jun 11
2
italic (PR#7932)
Full_Name: G. Grothendieck Version: R version 2.1.0, 2005-05-14 OS: Windows XP Submission from: (NULL) (216.59.254.207) This code: > plot(1:10) > text(5,5,lab=expression(italic(22*"33"))) has the effect of italicizing 33 (which is a character string) but not 22 (which is not). I would have thought that both, not just 33, would be italicized. I had previously posted about this
2016 May 25
0
Suggestion: mkString(NULL) should be NA
...should arguably > generate "". i don't think the fact that there is another way to get "" is > a particularly large problem. > On the other hand, and in support of your position it came up as Michael > Lawrence and I were talking about this that asChar from utils.c will give > you NA_STRING when you give it R_NilValue. That is a coercion though, > whereas arguably mkString is not. That said, consistency would probably be > good. > ~G > -- > Gabriel Becker, PhD > Associate Scientist (Bioinforma...
2016 May 24
2
Suggestion: mkString(NULL) should be NA
Shouldn't Rf_mkString(NULL) return (the c-level equivalent of) character() rather than the NA_character_? An empty string and NULL aren't the same. It seems reasonable for Rf_mkChar to give NA_character_ though. ~G On Tue, May 24, 2016 at 8:42 AM, Jeroen Ooms <jeroen.ooms at stat.ucla.edu> wrote: > On Thu, May 12, 2016 at 1:20 PM, Jeroen Ooms <jeroen.ooms at
2008 Mar 29
1
A patch for extending pdf device to embed popup text and web links
...t from, to; + char annot_text[1024] = ""; + + args = CDR(args); + x0 = asReal(CAR(args)); args = CDR(args); + y0 = asReal(CAR(args)); args = CDR(args); + x1 = asReal(CAR(args)); args = CDR(args); + y1 = asReal(CAR(args)); args = CDR(args); + text = (char *)CHAR(asChar(CAR(args))); args = CDR(args); + coord = (char *)CHAR(asChar(CAR(args))); + + if (strcmp("DEVICE", coord) == 0) { from = DEVICE; } + if (strcmp("NDC", coord) == 0) { from = NDC; } + if (strcmp("INCHES", coord) == 0) { from = INCHES; } + if (strcm...
2006 Apr 12
0
headerfile translation to Delphi (Pascal) completed
...es: - most prefixes ("Rf_", "R_", "do_", ...) and suffixes ("_t") are gone. An exception is "S_" which is shortened to "S" - the underscores ("_") are gone too. CamelCaseStyleConvention is used. - different versions (Rf_asChar, asChar) become one (riAsChar) - the letter following R (or S) is written in capital (e.g. aSExp) - the following prefixes are used (to avoid name clashes): - a small "r" (e.g.rNormRand), except for - a small "ri" for things in Rinternals (e.g. riReal) and except -...
2007 Oct 03
1
R-2.6.0 is released
...o memory allocated using R_alloc. This can be used to create a copy of a string stored in a CHARSXP before passing the data on to a function that modifies its arguments. o asLogical, asInteger, asReal and asComplex now accept STRSXP and CHARSXP arguments, and asChar accepts CHARSXP. o New R_GE_str2col() exported via R_ext/GraphicsEngine.h for external device developers. o doKeybd and doMouseevent are now exported in GraphicsDevice.h. o R_alloc now has first argument of type 'size_t' to support 64-bit platforms (e.g....
2007 Oct 03
1
R-2.6.0 is released
...o memory allocated using R_alloc. This can be used to create a copy of a string stored in a CHARSXP before passing the data on to a function that modifies its arguments. o asLogical, asInteger, asReal and asComplex now accept STRSXP and CHARSXP arguments, and asChar accepts CHARSXP. o New R_GE_str2col() exported via R_ext/GraphicsEngine.h for external device developers. o doKeybd and doMouseevent are now exported in GraphicsDevice.h. o R_alloc now has first argument of type 'size_t' to support 64-bit platforms (e.g....