search for: stringfromreal

Displaying 3 results from an estimated 3 matches for "stringfromreal".

2003 Feb 02
1
printing reals from C with digits -- once more
...to find something more R-ish. PrintValue() seems promising (it understands when I change options(digits) but I did not get it to print a single value. I tried SEXP variable; PrintValue(VECTOR_ELT(variable, i)); which lead to crash, while PrintValue(variable); prints the whole vector. StringFromReal() (and printing as CHAR) is otherwise nice but I dont know how can I make it to understand options(digits). Can anybody suggest me a way for this? Best wishes, Ott BTW, can I be sure that everything defined in /usr/lib/R/include and R_ext are (more or less) safe to use? | From: Prof Brian...
2003 Jan 29
1
printing reals from C with digits
Hi, I want to print real numbers in C code with different values for digits. How to do that? As I have understood, what I should do is to call StringFromReal() which calls FormatReal(), that one suggests the parameters (width, decimal places and exponential form). FormatReal() includes eps = pow(10.0, -(double)R_print.digits); So I guess I have to change the value of R_print.digits. R_print.digits is defined in include/Print.h in the package sou...
2009 May 23
2
as.numeric(levels(factor(x))) may be a decreasing sequence
...= '9') { + if (*(p++) != '0') { + replace = (char *) p; + } + } + while (*(replace++) = *(p++)) { + ; + } + break; + } + } + return s; +} + SEXP attribute_hidden StringFromReal(double x, int *warn) { int w, d, e; formatReal(&x, 1, &w, &d, &e, 0); if (ISNA(x)) return NA_STRING; - else return mkChar(EncodeReal(x, w, d, e, OutDec)); + else return mkChar(elim_trailing(EncodeReal(x, w, d, e, OutDec), OutDec)); } SEXP attribute_hidden S...