similar to: Convert STRSXP or INTSXP to factor

Displaying 20 results from an estimated 6000 matches similar to: "Convert STRSXP or INTSXP to factor"

2019 Jul 15
0
Convert STRSXP or INTSXP to factor
Hi Morgan, So if the goal is output identical to calling factor, one thing youc an do is construct and evaluate a call to the R-level factor function. That would work and be guaranteed to meet your requirement. The factor function is implemented with R code, without even any direct calls down to C code, so there isn't any C level functionality already there that you could try to hit
2014 Jun 24
2
using C code to create data frame but always return as list
there is my code,  expect return value  is a data frame but R say it is list: SEXP Julia_R_MD_NA_DataFrame(jl_value_t* Var) {  SEXP ans,names,rownames;  char evalcmd[4096];  int i;  const char* dfname="DataFrameName0tmp";  jl_set_global(jl_main_module, jl_symbol(dfname), (jl_value_t*)Var);  //Get Frame cols   sprintf(evalcmd,"size(%s,2)",dfname);  jl_value_t*
2003 Sep 05
1
Problem with S4 slots in C code (PR#4073)
This message is in MIME format. Since your mail reader does not understand this format, some or all of this message may not be legible. ------_=_NextPart_000_01C3738F.63DE3390 Content-Type: text/plain; charset="iso-8859-1" #I want to be able to create a new S4 class and read data into it using C code # Here is a very simple S4 object inheriting from "array", but with 5
2019 Jun 14
2
R C API resize matrix
Hi, Is there a way to resize a matrix defined as follows: SEXP a = PROTECT(allocMatrix(INTSXP, 10, 2)); int *pa = INTEGER(a) To row = 5 and col = 1 or do I have to allocate a second matrix "b" with pointer *pb and do a "for" loop to transfer the value of a to b? Thank you Best regards Morgan [[alternative HTML version deleted]]
2005 Jul 15
3
Passing character strings from C code to R
Hi, I have a C code which produces array of integers and potentially a string, and I have problems passing the string out. Here is the relevant part of the code: 1 PROTECT(Ret = allocVector(INTSXP, n)); 2 ret = (int*) INTEGER(Ret); /* get pointer to R's Ret */ 3 for(i=0; i<n; i++) ret[i] = data[i]; 4 Free(data); 5 i=1; 6 if (comment) { // comment was found 7 n
2005 Jul 15
3
Passing character strings from C code to R
Hi, I have a C code which produces array of integers and potentially a string, and I have problems passing the string out. Here is the relevant part of the code: 1 PROTECT(Ret = allocVector(INTSXP, n)); 2 ret = (int*) INTEGER(Ret); /* get pointer to R's Ret */ 3 for(i=0; i<n; i++) ret[i] = data[i]; 4 Free(data); 5 i=1; 6 if (comment) { // comment was found 7 n
2014 Mar 06
1
Create dataframe in C from table and return to R
Hi , I am trying to create a dataframe in C and sebd it back to R. Can anyone point me to the part of the source code where it is doing , let me explain the problem I am having . -------------------------------------------------------------------- My simple implementation is like this SEXP formDF() { SEXP dfm ,df , dfint , dfStr,lsnm; char *ab[3] =
2014 Apr 03
1
question regarding lang2 command in C
Hi , I am asking too many questions , sorry for that . I am creating a data frame in C itself , reading a table . The data frame calling code looks like this ====================================== *PROTECT(dfm=lang2(install("data.frame"),df));* *SEXP res = PROTECT(eval(dfm,R_GlobalEnv));* UNPROTECT(2); return res; ================================== It works fine , now the problem
2016 Oct 24
3
typo or stale info in qr man
man for `qr` says that the function uses LINPACK's DQRDC, while it in fact uses DQRDC2. ``` The QR decomposition of the matrix as computed by LINPACK or LAPACK. The components in the returned value correspond directly to the values returned by DQRDC/DGEQP3/ZGEQP3 ```
2019 Jul 17
2
ALTREP wrappers and factors
Hello, I?m experimenting with ALTREP and was wondering if there is a preferred way to create an ALTREP wrapper vector without using .Internal(wrap_meta(?)), which R CMD check doesn?t like since it uses an .Internal() function. I was trying to create a factor that used an ALTREP integer, but attempting to set the class and levels attributes always ended up duplicating and materializing the
2019 Oct 11
2
New matrix function
I think you are confusing package and function here. Plus some of the R Core packages, that you mention, contain functions that should probably be replaced by functions with better implementation from packages on CRAN. Best regards Morgan On Fri, 11 Oct 2019 15:22 Joris Meys, <jorismeys at gmail.com> wrote: > > > On Fri, Oct 11, 2019 at 3:55 PM Morgan Morgan <morgan.emailbox
2006 Nov 17
1
Manipulating R lists in C
Hi, I have been studying the R manual on lists but cannot seem to create a simple R list in C - I keep on getting "'dimnames' applied to non-array" whenever I attempt to assign names to the list elements: Wanted output a list structure something like [ type="Bid", price=2.0, volume=1000 ] I can get up to a list of [ "Bid2, 2.0, 1000 ] But for the life of
2019 Oct 11
4
New matrix function
How do you prove usefulness of a feature? Do you have an example of a feature that has been added after proving to be useful in the package space first? Thank you, Morgan On Fri, 11 Oct 2019 13:53 Michael Lawrence, <lawrence.michael at gene.com> wrote: > Thanks for this interesting suggestion, Morgan. While there is no strict > criteria for base R inclusion, one criterion relevant
2007 Nov 16
4
Returning vectors of two different data types back to R environment (from C).
Hello, Quick question. I have written a C function - I would like to make it return two vectors to the R environment - one STRSXP vector, and one INTSXP vector. Is this possible/ easy to do using the API? I looked, but could not find the answer to this question in the "Writing R Extensions" guide. Thanks very much for your help! Charles [[alternative HTML version deleted]]
2019 Jul 19
2
ALTREP wrappers and factors
Hi Jiefei and Kylie, Great to see people engaging with the ALTREP framework and identifying places we may need more tooling. Comments inline. On Thu, Jul 18, 2019 at 12:22 PM King Jiefei <szwjf08 at gmail.com> wrote: > > If that is the case and you are 100% sure the reference number should be 1 > for your variable *y*, my solution is to call *SET_NAMED *in C++ to reset > the
2020 Jun 30
3
Build a R call at C level
On 6/30/20 1:06 PM, Jan Gorecki wrote: > It is quite known that R documentation on R C api could be improved... Please see "5.11 Evaluating R expressions from C" from "Writing R Extensions" Best Tomas > Still R-package-devel mailing list should be preferred for this kind > of questions. > Not sure if that is the best way, but works. > > call_to_sum <-
2020 May 20
2
Precision of function mean,bug?
> On Wednesday, May 20, 2020, 7:00:09 AM EDT, peter dalgaard <pdalgd at gmail.com> wrote: > > Expected, see FAQ 7.31. > > You just can't trust == on FP operations. Notice also Additionally, since you're implementing a "mean" function you are testing against R's mean, you might want to consider that R uses a two-pass calculation[1] to reduce floating
2001 Dec 07
2
Memory problem
Dear all, I have written a little R program to convert images. See below. Within the loop over j (the filenames) memory consumption grows constantly. rm( ... ) inside the loop did not help. Memory does not grow if I remove the writeBin statements between the two #-------- marks. But obviously this is not solution I want... Thanks for any advice. Manfred Baumstark P.S. As I'm new to R:
2019 Oct 11
3
New matrix function
On Fri, 11 Oct 2019 10:45 Duncan Murdoch, <murdoch.duncan at gmail.com> wrote: > On 11/10/2019 6:44 a.m., Morgan Morgan wrote: > > Hi All, > > > > I was looking for a function to find a small matrix inside a larger > matrix > > in R similar to the one described in the following link: > > > > >
2019 Feb 28
3
Package inclusion in R core implementation
Hi, It sometimes happens that some packages get included to R like for example the parallel package. I was wondering if there is a process to decide whether or not to include a package in the core implementation of R? For example, why not include the Rcpp package, which became for a lot of user the main tool to extend R? What is our view on the (not so well known) dotCall64 package which is an