Displaying 20 results from an estimated 23 matches for "asreal".
Did you mean:
areal
2018 Feb 02
1
R-gui sessions end when executing C-code
...rot++;
PROTECT(H); n_prot++;
PROTECT(K); n_prot++;
int N_c = asInteger(N);
int H_c = asInteger(H);
int K_c = asInteger(K);
double mu_c = asReal(mu);
double mu2_c = 1.0 - mu_c;
double error_c = asReal(err);
double lowest_double = 1e-15;
double tmp_c;
double denom;
double error_temp...
2006 Nov 08
1
convert factor p000345 to numeric
...numerical.
>as.numeric(as.character(largeset$ID)) gives NA's
>as.numeric(strsplit(as.character(largeset[,1]), "p")) also fails:
Error in as.double.default(strsplit(as.character(largeset[, 1]), "p")) :
unimplemented type 'character' in 'asReal'
Any suggestions would be very appreciated
Marco
[[alternative HTML version deleted]]
2015 Sep 20
2
Long vectors: Missing values and R_xlen_t?
Is there a missing value constant defined for R_xlen_t, cf. NA_INTEGER
(== R_NaInt == INT_MIN) for int(eger)? If not, is it correct to
assume that missing values should be taken care/tested for before
coercing from int or double?
Thank you,
Henrik
2008 Apr 10
1
Computing time when calling C functions - why does an extra function call induce such an overhead?
...the computations take only 0.03 secs. Can anyone tell me why there is such a "time-overhead" in introducing the extra function call to mysolve2?
I am on windows XP using R 2.6.1
Best regards
S?ren
SEXP mysolve1(SEXP Ain, SEXP Bin, SEXP tolin)
{
int *Adims, *Bdims;
double tol = asReal(tolin);
SEXP A, B;
PROTECT(A = duplicate(Ain));
PROTECT(B = duplicate(Bin));
Adims = INTEGER(coerceVector(getAttrib(A, R_DimSymbol), INTSXP));
Bdims = INTEGER(coerceVector(getAttrib(B, R_DimSymbol), INTSXP));
int nrA, ncB;
double *Ap, *Bp;
nrA = Adims[0];
ncB = Bdims[1];...
2007 Jul 10
1
How to preserve data across function calls in a library package
...ok;
int* foot;
void foo(void){
Rprintf("many times\n");
Rprintf("%p\n",book);
Rprintf("%p\n",foot);
}
SEXP
kNN_e(SEXP data, SEXP Nrow, SEXP Ncol,SEXP K,SEXP Eps)
{
int nrow=asInteger(Nrow);
int ncol=asInteger(Ncol);
int k=asInteger(K);
double eps=asReal(Eps);
SEXP ans,distance;
SEXP retlist;
PROTECT(ans=allocMatrix(INTSXP,nrow,k)); //The 2nd argument gives
the number of rows, and the last the number of cols see http://cran.r-
project.org/doc/manuals/R-exts.html
PROTECT(distance=allocMatrix(REALSXP,nrow,k));
ANNpointArray datapoi...
2007 Jul 10
1
How to preserve data across function calls in a library package
...ok;
int* foot;
void foo(void){
Rprintf("many times\n");
Rprintf("%p\n",book);
Rprintf("%p\n",foot);
}
SEXP
kNN_e(SEXP data, SEXP Nrow, SEXP Ncol,SEXP K,SEXP Eps)
{
int nrow=asInteger(Nrow);
int ncol=asInteger(Ncol);
int k=asInteger(K);
double eps=asReal(Eps);
SEXP ans,distance;
SEXP retlist;
PROTECT(ans=allocMatrix(INTSXP,nrow,k)); //The 2nd argument gives
the number of rows, and the last the number of cols see http://cran.r-
project.org/doc/manuals/R-exts.html
PROTECT(distance=allocMatrix(REALSXP,nrow,k));
ANNpointArray datapoi...
2008 Mar 29
1
A patch for extending pdf device to embed popup text and web links
...+
+ SEXP PDFAnnotBox(SEXP args)
+ {
+ pGEDevDesc gdd = GEcurrentDevice();
+ PDFDesc *pd = (PDFDesc *) gdd->dev->deviceSpecific;
+ double x0, y0, x1, y1;
+ char *text, *coord;
+ GUnit 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 (st...
2017 Jan 04
4
seq.int/seq.default
...? is a standard generic with a default method.
> ?seq.int? is a primitive which can be much faster but has a few restrictions.
>
> > I have found two cases so far where they differ, first
> > that seq.int will coerce a character string to a real (via
> > Rf_asReal) whereas seq.default appears to coerce it to NA
> > and then throws an error:
>
> >> seq.default("2", "5")
> > Error in seq.default("2", "5") : 'from' cannot be NA, NaN or infinite
> >> seq.int(&quo...
2007 Mar 27
3
Use of 'defineVar' and 'install' in .Call
Dear all,
[system and version information below]
I am trying to modify a C function for finding the root of an
expression. The function is to be called from R as .Call with input
parameters:
f: expression for which we will find the root
guesses: interval for the solution
stol: tolerance
rho: environment
The original functions I use are:
SEXP mkans(double x) {
SEXP ans;
PROTECT(ans =
2007 Mar 27
3
Use of 'defineVar' and 'install' in .Call
Dear all,
[system and version information below]
I am trying to modify a C function for finding the root of an
expression. The function is to be called from R as .Call with input
parameters:
f: expression for which we will find the root
guesses: interval for the solution
stol: tolerance
rho: environment
The original functions I use are:
SEXP mkans(double x) {
SEXP ans;
PROTECT(ans =
2004 Nov 29
1
data is getting corrupted
...ptr->stand_name,
CHAR(STRING_ELT(get_list_element(sample,"stand.name"), 0)) );
strcpy( s_ptr->legal, CHAR(STRING_ELT(get_list_element(sample,"legal"),
0)) );
s_ptr->elevation = asInteger( get_list_element( sample, "elevation" ) );
s_ptr->acreage = asReal( get_list_element( sample, "acreage" ) );
s_ptr->age = asInteger( get_list_element( sample, "age" ) );
s_ptr->sampled_month = asInteger( get_list_element( sample,
"sampled.month" ) );
s_ptr->sampled_day = asInteger( get_list_element( sample, "sam...
2009 Jan 19
1
patch for textspecial and defaultfont in xfig
...pGEDevDesc gdd;
char *vmax;
const char *file, *paper, *family, *bg, *fg, *encoding;
- int horizontal, onefile, pagecentre;
+ int horizontal, onefile, pagecentre, defaultfont, textspecial;
double height, width, ps;
vmax = vmaxget();
@@ -7467,6 +7476,8 @@
ps = 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(...
2015 Sep 21
0
Long vectors: Missing values and R_xlen_t?
...convert an index I tend to use this utility for convenience:
static R_INLINE R_xlen_t asLength(SEXP x, R_xlen_t NA) {
double d;
if (TYPEOF(x) == INTSXP && LENGTH(x) > 0) {
int res = INTEGER(x)[0];
return (res == NA_INTEGER) ? NA : ((R_xlen_t) res);
}
d = asReal(x);
return (R_finite(d)) ? ((R_xlen_t) d) : NA;
}
Note that this explicitly allows the caller to specify NA representation since it depends on the use - often it's simply 0, other times -1 will do since typically anything negative is equally bad. As noted above, this is not what R itself d...
1998 Jul 01
4
R-beta: R-0.62.1 under Digital Unix
I am grateful for the advice of Douglas Bates on my earlier problem in making
R-0.62.1, but I'm afraid I'm still having problems....
I have been installing the various updates to R for quite some time on my
alpha, and it is only now that I have been having really severe problems.
The three or 4 versions before 0.61.1 installed without error. For 0.61.1 I
needed to install GNU make.
For
2017 Jan 05
0
seq.int/seq.default
...with a default method.
>> ?seq.int? is a primitive which can be much faster but has a few restrictions.
>>
>> > I have found two cases so far where they differ, first
>> > that seq.int will coerce a character string to a real (via
>> > Rf_asReal) whereas seq.default appears to coerce it to NA
>> > and then throws an error:
>>
>> >> seq.default("2", "5")
>> > Error in seq.default("2", "5") : 'from' cannot be NA, NaN or infinite
>>...
1998 Jan 07
2
R-beta: sequences
A non-text attachment was scrubbed...
Name: not available
Type: text
Size: 1659 bytes
Desc: not available
Url : https://stat.ethz.ch/pipermail/r-help/attachments/19980107/3a4902ef/attachment.pl
1998 Jan 07
2
R-beta: sequences
A non-text attachment was scrubbed...
Name: not available
Type: text
Size: 1659 bytes
Desc: not available
Url : https://stat.ethz.ch/pipermail/r-help/attachments/19980107/3a4902ef/attachment.pl
2006 Mar 28
3
R, RMysql, and MySQL 5 Decimal Type Support
Hi,
Whenever I have a MySQL query that returns a Decimal result to R I get
the following warning in R:
Warning message:
RS-DBI driver warning: (unrecognized MySQL field type 246 in column 1)
I get this for a simple query like "SELECT 2, 2.5" !!
I am using:
R ver 2.1.1
RMySQL ver. 0.5-7
DBI ver. 0.1-10
MySQL Ver 14.12 Distrib 5.0.18.
Please Help!
Jason
2017 Jan 03
2
seq.int/seq.default
...R code for seq.default and the C code for seq.int
appear to be semantically very similar. My question is whether, in fact,
it is intended that behave identically for all inputs. I have found two
cases so far where they differ, first that seq.int will coerce a
character string to a real (via Rf_asReal) whereas seq.default appears
to coerce it to NA and then throws an error:
> seq.default("2", "5")
Error in seq.default("2", "5") : 'from' cannot be NA, NaN or infinite
> seq.int("2", "5")
[1] 2 3 4 5
>
and second, th...
2007 Jun 06
3
C function with unknown output length
Hi all,
Could anyone point me to one or more examples in the R sources of a C
function that is called without knowing in advance what will be the
length (say) of the output vector?
To make myself clearer, we have a C function that computes
probabilities until their sum gets "close enough" to 1. Hence, the
number of probabilities is not known in advance.
I would like to have an