similar to: In C, a fast way to slice a vector?

Displaying 20 results from an estimated 1000 matches similar to: "In C, a fast way to slice a vector?"

2009 Sep 20
1
Return a list from a .Call but segfaults
Hello, I call a function via .Call passing to it a raw vector(D) and an integer(I) The vector is a series K1,KData1, V1,VData1, K2, KData2, ... where the integer K1 is the length of Data1 and similarly for Ki (wrt Datai)(similarly for V*) There 2*I such pairs( (Ki,KDatai), (Vi,VDatai)) The numbers Ki(and Vi) are written in network order. I am returning a list of I elements each element a
2008 Dec 15
3
install.packages and dependency version checking
I've started to implement checks for package versions on dependencies in install.packages(). However, this is revealing a number of problems/misconceptions. (A) We do not check versions when loading namespaces, ahd the namespace registry does not contain version information. So that for example (rtracklayer) Depends: R (>= 2.7.0), Biobase, methods, RCurl Imports: XML (>=
2010 Jun 20
1
How to debug: Cons memory exhausted
Hello, I get an error when binary structures from a pipe 'Error: cons memory exhausted (limit reached?)' (but R does not crash) This is probably due to some bug in my code, but occurs after reading about 85K pairs of RAWSXP objects (each < 20 bytes). I do not have any explicit calls to malloc/calloc I'm going through my code and have inserted the (brute force) printf statements
2010 May 31
3
after updating biomaRt cannot connect any more
I recently updated R 2.10.1 Patched (2010-02-20 r51163) This morning I reinstalled biomaRt using biocLite. Now I can no more connect to biomaRt and even the following instruction is hanging for a while until the same error message pops up. > listMarts() Error in value[[3L]](cond) : Request to BioMart web service failed. Verify if you are still connected to the internet. Alternatively the
2011 Jun 15
4
R string functions
Hi, I have a string "GGGGGGCCCAATCGCAATTCCAATT" What I want to do is to count the percentage of each letter in the string, what string functions can I use to count the number of each letter appearing in the string? For example, the letter "A" appeared 6 times, letter "T" appeared 5 times, how can I use a string function to get the these number? thanks, karena
2009 Mar 30
1
List assignment in a while loop and timing
Hello R users I have question about the time involved in list assignment. Consider the following code snippet(see below). The first line creates a reader object, which is the interface to 1MM key-value pairs (serialized R objects) spanning 50 files (a total of 50MB). rhsqstart initiates the reading and I loop, reading each key-value pair using rhsqnextKVR. If this returns NULL, we switch to the
2012 Dec 17
1
Code works standalone, yet same code fails when part of package
Hi I'm missing something here but I cannot figure out what. What I can see is that the same code works when I load it via source(...) yet fails when I execute it after loading the package I have built (which includes the code. Below is a transcript of my R session. First I load the code from a file, using source(). Then I execute it fine. Then I remove the function object, I load the
2009 Jul 09
1
bug in seq_along
Using the IRanges package from Bioconductor and somewhat recent R-2.9.1. ov = IRanges(1:3, 4:6) length(ov) # 3 seq(along = ov) # 1 2 3 as wanted seq_along(ov) # 1! I had expected that the last line would yield 1:3. My guess is that somehow seq_along don't utilize that ov is an S4 class with a length method. The last line of the *Details* section of ?seq has a typeo. Currently it is
2013 Jun 27
3
Read a text file into R with .Call()
Hi, I want to read a text file into R with .Call(). So I define some NEW_CHARACTER() to store the chracters read and use SET_STRING_ELT to fill the elements. e.g. PROTECT(qNames = NEW_CHARACTER(10000)); char *foo; // This foo holds the string I want. while(foo = readLine(FN)){ SET_STRING_ELT(qNames, i, mkChar(foo))); } In this way, I can get the desired character from qNames. The only problem
2006 Jan 27
1
rbind/cbind unimplemented for raw (RAWSXP) types. (PR#8529)
Full_Name: Hin-Tak Leung Version: R 2.2.1 OS: x86_64-redhat-linux-gnu Submission from: (NULL) (131.111.186.92) rbind/cbind is unimplemented for raw (RAWSXP) types. I have a working patch implementing the functionality, to follow. --please do not edit the information below-- Version: platform = x86_64-redhat-linux-gnu arch = x86_64 os = linux-gnu system = x86_64, linux-gnu status = major
2006 Nov 21
2
packBits (PR#9374)
Full_Name: Prokaj Vilmos Version: R 2-4-0 OS: Windows Submission from: (NULL) (193.224.79.8) PackBits(rbinom(32,1,0.5)==1,"integer") does not work. z<-packBits(rbinom(32,1,.5)==1,"integer") Error in packBits(x, type) : argument 'x' must be raw, integer or logical Taking a closer look at the C code main/character.c do_packBits rutin one can find the following
2010 Aug 22
1
Handle RAWSXP in inspect.c:typename()
Hi all I had written a gdb macro to dump the string representation of an SEXPREC type when I realised everything I needed was in inspect.c already in the typename() function. However, the typename function doesnt handle the RAWSXP type, so if possible, could the following patch be applied (I've just put in inline as it is a trivial 1-liner)? Index: src/main/inspect.c
2010 Jun 19
1
more powerful iconv
R community, As you may know, R's iconv doesn't work well converting to and from encodings that allow embedded nulls. For example > iconv("foo", to="UTF-16") Error in iconv("foo", to = "UTF-16") : embedded nul in string: '\xff\xfef\0o\0o\0' However, I don't believe embedded nulls are at issue here, but rather that R's iconv
2007 Jan 28
2
reposTools
Dear List, I tested the example in the reposTools vignette: library(reposTools); Loading required package: tools genRepos("Test Repository", "http://biowww.dfci.harvard.edu/~jgentry/","newRepos"); Error in rep.int(colnames(x), nr) : unimplemented type 'NULL' in 'rep' Could someone help me out with this one? I'd appreciate all help.... I am
2005 Aug 20
1
Implementing a single-precision class with raw
A package that I develop (xcms) sometimes needs to read and process vectors several hundreds of megabytes in size. (They only represent parts of a large data sets which can approach nearly 100GB.) Unfortunately, R sometimes hits the 2GB memory limit of Win32. To help cut the memory footprint in half, I'm implementing a "float" class as a subclass of "raw". Because
2010 Feb 14
4
Feature Request: Multiline Comments
Hello, Is it possible to extend the R lexer/parser to include multiline comments like /* acomment */ ? This way I can integrate emacs org-mode with my R code, so that I can have a table of contents, section folding, html-output of source etc. e.g /* * Display Code */ #+BEGIN_SRC R foo <- function(...){ stuff } #+end_src and so on . Thanks Saptarshi
2009 Dec 01
4
Package is loaded but functions are not exported
Hello, I wrote a package, which in the NAMESPACE file exports functions like this: exportPattern("^\\rh") On R-2.8 (Linux, 64), upon loading the package I have the rh functions present. On R-2.10, Mac OS X, (32 bit), it builds, loads, but the functions are not loaded, i.e the only function is rhyper (which is not from my package). Is there something wrong with my package setup?
2008 Sep 19
1
Lines between panels in lattice
Hello, I have a multi-page display each consisting of two-panels above each other. I need to draw a line from the top panel to bottom panel. Using current.vpTree() i find that "plot1.panel.1.2.vp" and "plot1.panel.1.1.vp" are the top and bottom ones respectively. I am using the following code(inspired by Paul Murrell's R Graphics) to draw a line. (All the
2010 Feb 24
1
build, data and vignettes
Based on some testing it seems to me that if I have a package with a dataset in /data a Sweave vignette in inst/doc (but no associated pdf file) the vignette loads the data in /data through data(dataset) and I do a R CMD build R will try to build the pdf version of the vignette, but will be unable to find the dataset in data because the package is not yet installed. However, if I do
2012 Mar 16
3
Y-axis label on the right hand side in lattice?
Hello, Is there a way to add ylab on the right hand side also (in lattice)? Different from the left hand side? Cheers Saptarshi [[alternative HTML version deleted]]