Displaying 20 results from an estimated 25 matches for "rf_length".
2018 Sep 05
4
True length - length(unclass(x)) - without having to call unclass()?
...ed to do more without copying, and it
> is possible without breaking the value semantics, then you might need to
> switch to C anyway and for a bigger piece of code.
>
> If it were still just .length() you needed and it were performance
> critical, you could just switch to C and call Rf_length. That does not
> violate the semantics, just indeed it is not elegant as you are
> switching to C.
>
> If you stick to R and can live with the overhead of length(unclass(x))
> then there is a chance the overhead will decrease as R is optimized
> internally. This is possible in pri...
2018 Sep 05
0
True length - length(unclass(x)) - without having to call unclass()?
...other end, if you need to do more without copying, and it
is possible without breaking the value semantics, then you might need to
switch to C anyway and for a bigger piece of code.
If it were still just .length() you needed and it were performance
critical, you could just switch to C and call Rf_length. That does not
violate the semantics, just indeed it is not elegant as you are
switching to C.
If you stick to R and can live with the overhead of length(unclass(x))
then there is a chance the overhead will decrease as R is optimized
internally. This is possible in principle when the runtime k...
2018 Aug 24
5
True length - length(unclass(x)) - without having to call unclass()?
Is there a low-level function that returns the length of an object 'x'
- the length that for instance .subset(x) and .subset2(x) see? An
obvious candidate would be to use:
.length <- function(x) length(unclass(x))
However, I'm concerned that calling unclass(x) may trigger an
expensive copy internally in some cases. Is that concern unfounded?
Thxs,
Henrik
2018 Sep 10
0
True length - length(unclass(x)) - without having to call unclass()?
...t copying, and it
>> is possible without breaking the value semantics, then you might need to
>> switch to C anyway and for a bigger piece of code.
>>
>> If it were still just .length() you needed and it were performance
>> critical, you could just switch to C and call Rf_length. That does not
>> violate the semantics, just indeed it is not elegant as you are
>> switching to C.
>>
>> If you stick to R and can live with the overhead of length(unclass(x))
>> then there is a chance the overhead will decrease as R is optimized
>> internally....
2001 Apr 30
1
Segmentation fault linked to memory? (PR#929)
Hi Everyone,
The following rather extreme claim on memory causes a
segmentation fault on my installation:
fred <- matrix(1:1200, 20, 60)
littleOP <- function(x, y)
{
z <- as.vector(x) %*% t(as.vector(y))
dim(z) <- c(dim(x), dim(y))
z
}
littleOP(fred, fred) # this is OK
littleOP(littleOP(fred, fred), fred) # whoops! Segmentation fault
What's a bit strange
2004 Feb 17
1
RCMD SHLIB == Couldn't reserve space for cygwin's heap, Win32 ?
...declaration of function `minim_'
flikam.c:209: warning: implicit declaration of function `nelmin_'
flikam.c: In function `minim_objfunc':
flikam.c:293: warning: implicit declaration of function `flikam_'
flikam.c: In function `testfunc':
flikam.c:424: warning: passing arg 1 of `Rf_length' from incompatible
pointer type
flikam.c:425: warning: passing arg 1 of `Rf_length' from incompatible
pointer type
flikam.c:426: warning: passing arg 1 of `Rf_length' from incompatible
pointer type
flikam.c:428: warning: passing arg 1 of `Rf_coerceVector' from incompatible
pointer t...
2004 Feb 17
1
RCMD SHLIB == Couldn't reserve space for cygwin's heap, Win32 ?
...declaration of function `minim_'
flikam.c:209: warning: implicit declaration of function `nelmin_'
flikam.c: In function `minim_objfunc':
flikam.c:293: warning: implicit declaration of function `flikam_'
flikam.c: In function `testfunc':
flikam.c:424: warning: passing arg 1 of `Rf_length' from incompatible
pointer type
flikam.c:425: warning: passing arg 1 of `Rf_length' from incompatible
pointer type
flikam.c:426: warning: passing arg 1 of `Rf_length' from incompatible
pointer type
flikam.c:428: warning: passing arg 1 of `Rf_coerceVector' from incompatible
pointer t...
2014 Mar 31
1
C API to get numrow of data frame
Hi ,
Is there any C API to the R API nrow of dataframe ?
x<- data.frame()
n<- nrow(x)
print(n)
0
Example :
My C function which deals with data frame looks like and I don't to send
the number of rows of data frame .I want to detect it from the function
itself, my function take data frame as argument and do some on it. I want
API equivalent to nrow. I tried Rf_nrows,Rf_ncols . No
2013 Oct 16
1
Parallel R expression evaluations
...en_t i=0;
PROTECT(cmdSexp = Rf_allocVector(STRSXP, 1));
SET_STRING_ELT(cmdSexp, 0, cmd1);
// parsing vector for R expressions
cmdexpr = PROTECT(R_ParseVector(cmdSexp, -1, &status, R_NilValue));
if (status != PARSE_OK) {
UNPROTECT(2);
// error handling
return;
}
for(i = 0; i < Rf_length(cmdexpr); i++)
{
int error;
sresult = R_tryEval(VECTOR_ELT(cmdexpr, i), R_GlobalEnv, &error); // R
expression evaluation
if(error) // checking for error
{
// error handling
return;
}
}
UNPROTECT(2);
I wonder if R supports parallel evaluations within a single session. I ha...
2015 Aug 21
3
unset() function?
...;name' from the current evaluation
frame and return its value. It allowed you to safely avoid
some memory copying when calling .C or .Call.
E.g., suppose you had C code like
#include <R.h>
#include <Rinternals.h>
SEXP add1(SEXP pX)
{
int nProtected = 0;
int n = Rf_length(pX);
int i;
double* x;
Rprintf("NAMED(pX)=%d: ", NAMED(pX));
if (NAMED(pX)) {
Rprintf("Copying pX before adding 1\n");
PROTECT(pX = duplicate(pX)); nProtected++;
} else {
Rprintf("Changing pX in place\n");...
2012 Oct 03
3
Fastest non-overlapping binning mean function out there?
Hi,
I'm looking for a super-duper fast mean/sum binning implementation
available in R, and before implementing z = binnedMeans(x y) in native
code myself, does any one know of an existing function/package for
this? I'm sure it already exists. So, given data (x,y) and B bins
bx[1] < bx[2] < ... < bx[B] < bx[B+1], I'd like to calculate the
binned means (or sums)
2004 Feb 17
2
interfacing C++ using .Call
...> Rcmd SHLIB test.cpp
making test.d from test.cpp
g++ -Id:/R/rw1081/src/include -Wall -O2 -c test.cpp -o test.o
ar cr test.a *.o
ranlib test.a
g++ --shared -s -o test.dll test.def test.a
-Ld:/R/rw1081/src/gnuwin32 -lg2c -lR
test.a(test.o.b)(.text+0x61):test.cpp: undefined reference to
`Rf_length(SEXPREC*)'
test.a(test.o.b)(.text+0x6e):test.cpp: undefined reference to
`Rf_isNewList(SEXPREC*)'
test.a(test.o.b)(.text+0x82):test.cpp: undefined reference to
`Rf_isFunction(SEXPREC*)'
test.a(test.o.b)(.text+0x99):test.cpp: undefined reference to
`Rf_isEnvironment(SEXPREC*)'
tes...
2009 Sep 03
1
Running an expression 1MN times using embedded R
...,Rerr;
ParseStatus status;
PROTECT(cmdSexp = Rf_allocVector(STRSXP, 1));
SET_STRING_ELT(cmdSexp, 0, Rf_mkChar(cmd));
cmdexpr = PROTECT(R_ParseVector(cmdSexp, -1, &status, R_NilValue));
if (status != PARSE_OK) {
UNPROTECT(2);
return(R_NilValue);
}
for(i = 0; i < Rf_length(cmdexpr); i++)
ans = R_tryEval(VECTOR_ELT(cmdexpr, i),NULL,&Rerr);
UNPROTECT(2);
return(ans);
}
int embedR(int argc, char **argv){
structRstart rp;
Rstart Rp = &rp;
R_DefParams(Rp);
Rp->NoRenviron = 0;
Rp->R_Interactive = (Rboolean)1;
R_SetParams(Rp);...
2004 Feb 02
0
problem building R on HPUX 11.23
When building the X11 modules under HPUX 11.23 I get the following errors
ld: Unsatisfied symbol "Rf_isNull" in file dataentry.lo
ld: Unsatisfied symbol "Rf_length" in file dataentry.lo
ld: Unsatisfied symbol "Rf_warningcall" in file devX11.lo
ld: Unsatisfied symbol "UNIMPLEMENTED" in file dataentry.lo
ld: Unsatisfied symbol "R_alloc" in file devX11.lo
ld: Unsatisfied symbol "R_GlobalEnv" in file dataentry.lo
ld: U...
2002 Jan 02
1
Building R-1.4 on Tru64
...protect
Rf_substitute
Rf_unprotect
Rf_duplicate
Rf_VectorToPairList
R_NilValue
Rf_NewEnvironment
R_set_standardGeneric_ptr
R_GlobalEnv
R_set_quick_method_check
Rf_install
Rf_allocVector
LOGICAL
R_PreserveObject
Rf_mkChar
SET_STRING_ELT
Rf_findVar
R_UnboundValue
VECTOR_ELT
R_NamesSymbol
Rf_getAttrib
Rf_length
STRING_ELT
R_CHAR
R_do_slot
Rf_asChar
PRINTNAME
Rf_isNull
CAR
CDR
R_data_class
Rf_isFunction
Rf_findFun
SETCAR
Rf_eval
INTEGER
CLOENV
Rf_findVarInFrame
Rf_isSymbol
ENCLOS
SYMVALUE
Rf_asLogical
R_MissingArg
Rf_isPrimitive
do_set_prim_method
BODY
R_deferred_default_method
PREXPR
PRENV
R_DotsSymbol
DD...
2015 Aug 22
0
unset() function?
...frame and return its value. It allowed you to safely avoid
> some memory copying when calling .C or .Call.
>
> E.g., suppose you had C code like
> #include <R.h>
> #include <Rinternals.h>
> SEXP add1(SEXP pX)
> {
> int nProtected = 0;
> int n = Rf_length(pX);
> int i;
> double* x;
> Rprintf("NAMED(pX)=%d: ", NAMED(pX));
> if (NAMED(pX)) {
> Rprintf("Copying pX before adding 1\n");
> PROTECT(pX = duplicate(pX)); nProtected++;
> } else {
> Rprintf("Ch...
2006 Apr 12
0
headerfile translation to Delphi (Pascal) completed
...;
- arguments start with an underscore followed by a small letter
Misc:
- Pointer type arguments have been translated as pointers
(E.g. "x *int" becomes "_x: pInteger" and NOT "var _x: integer")
- Unfortunately there are two forms of length (LENGTH and length/Rf_length)
in the header file Rinternals. The
- vector access macro LENGTH becomes riLength and
- the ??? length(x)/Rf_length become rLength.
--- USE_RINTERNAL (RINTERNALS.H) ---
The file "Rinternals.h" contains two sets of functions: one with "real"
functions who are expor...
2013 Apr 26
2
speed of a vector operation question
Hello,
I am dealing with numeric vectors 10^5 to 10^6 elements long. The values are
sorted (with duplicates) in the vector (v). I am obtaining the length of
vectors such as (v < c) or (v > c1 & v < c2), where c, c1, c2 are some scalar
variables. What is the most efficient way to do this?
I am using sum(v < c) since TRUE's are 1's and FALSE's are 0's. This
2010 May 06
1
R on kdeedu-svn library problem
...#39;
$SOURCES/kdeedu/cantor/src/backends/R/rserver/rserver.cpp:234: undefined
reference to `VECTOR_ELT'
$SOURCES/kdeedu/cantor/src/backends/R/rserver/rserver.cpp:234: undefined
reference to `R_tryEval'
$SOURCES/kdeedu/cantor/src/backends/R/rserver/rserver.cpp:232: undefined
reference to `Rf_length'
CMakeFiles/cantor_rserver.dir/rserver.o: In function `RServer::autoload()':
$SOURCES/kdeedu/cantor/src/backends/R/rserver/rserver.cpp:137: undefined
reference to `R_GlobalEnv'
$SOURCES/kdeedu/cantor/src/backends/R/rserver/rserver.cpp:137: undefined
reference to `Rf_install'
$SOUR...
2008 Oct 17
1
missing Rversion.h and Rconfig.h when installing RSQLite under FC8
..."
RS-DBI.c: In function ''RS_DBI_makeDataFrame'':
RS-DBI.c:396: warning: implicit declaration of function ''SET_CHR_EL''
RS-DBI.c:399: warning: implicit declaration of function ''LST_EL''
RS-DBI.c:399: warning: passing argument 1 of ''Rf_length'' makes pointer
from integer without a cast
RS-DBI.c: In function ''RS_DBI_allocOutput'':
RS-DBI.c:426: warning: assignment makes pointer from integer without a
cast
RS-DBI.c: In function ''RS_DBI_copyfields'':
RS-DBI.c:627: warning: implicit declaration...