search for: readchars

Displaying 20 results from an estimated 112 matches for "readchars".

Did you mean: readchar
2007 Jun 14
1
Clarification for readChar man page
Hi, Here's a patch to the readChar manual page (R-trunk as of today) that better clarifies readChar's return value. It could use some work as I'd also like to add some text about using nchar() to find the length of the string that readchar() returns, but I'm unsure which of type="bytes" or type="chars" to mention. Is it type="chars"? Index:
2018 May 26
2
Buffering in R 3.5 connections causes incorrect data in readChar
I noticed an issue where readChar does not return the correct value after a call to readline. It appears that readChar is not aware of the buffering, so it reads from the end of the buffer, rather than the current position in the file. This is a significant change of behavior from R-3.4.4. Below is a test case that I used to home in on the problem. --- p<-"test2.txt"
2006 Nov 07
1
reading VERY large binary files
Hello, I am trying to read in elements out of a very large binary file ... the total file is 4 gigs. I want to select rows out of the file, and the current procedure I run works but is prohibitively slow (takes more than a day to run and still won't complete). Is there any faster way to accomplish this? My current procedure looks like this: readHH <- function(file_name,
2024 Jan 26
1
readChar() could read the whole file by default?
I am curious why readLines() has a default (n=-1L) to read the full file while readChar() has no default for nchars= (i.e., readChar(file) is an error). Is there a technical reason for this? I often[1] see code like paste(readLines(f), collapse="\n") which would be better served by readChar(), especially given issues with the global string cache I've come across[2]. But lacking the
2024 Jan 29
1
[External] readChar() could read the whole file by default?
My opinion is that the proposed feature would be greatly appreciated by users. I had always wondered if I was the only one doing paste(readLines(f), collapse="\n") all the time. It would be great to have the proposed, more straightforward way to read the whole file as a string: readChar("my_file.txt", -1) or even better readChar("my_file.txt") Thanks for your detailed
2024 Jan 26
1
[External] readChar() could read the whole file by default?
On Fri, 26 Jan 2024, Michael Chirico wrote: > I am curious why readLines() has a default (n=-1L) to read the full > file while readChar() has no default for nchars= (i.e., readChar(file) > is an error). Is there a technical reason for this? > > I often[1] see code like paste(readLines(f), collapse="\n") which > would be better served by readChar(), especially given
2018 May 29
1
Buffering in R 3.5 connections causes incorrect data in readChar
Tomas, Thank you for the explanation. I see in the documentation: "These functions are intended to be used with binary-mode connections." So I see how using it on a text connection is undefined, and not a bug. An error or warning when attempting to use a it on a text connection would be helpful considering how the behavior has changed in R-3.5. On Tue, May 29, 2018 at 3:09 AM, Tomas
2018 May 29
0
Buffering in R 3.5 connections causes incorrect data in readChar
On 05/26/2018 05:15 AM, Aaron Goodman wrote: > I noticed an issue where readChar does not return the correct value after a > call to readline. It appears that readChar is not aware of the buffering, > so it reads from the end of the buffer, rather than the current position in > the file. This is a significant change of behavior from R-3.4.4. > > Below is a test case that I used
2006 Apr 27
1
Error in readChar(): invalid UTF-8 input
I have R code to read a binary header file, consisting of several readBin() and readChar() statements. I am currently using version R-2.2.1 (on x86_64, RH EL4) and have received the following error Error in readChar(fid, n = 1) : invalid UTF-8 input in readChar() This is strange because (a) I was able to read in this file successfully in previous versions of R (circa 2005) and (b) it
2011 Aug 04
1
slightly speeding up readChar()
Hi, I was trying to have R read files faster with readChar(). That was before I noticed that readChar() is not that bad! In any case, below I suggest a few simple changes that will make readChar slightly faster. I followed readChar(useBytes=T), and tried to identify all O(N) operations, where N is the size of the file. The assumption is that for LARGE files we want to avoid any O(N) operations,
2009 Sep 04
0
passing character vectors to FORTRAN
Hi, I've been trying to pass a character vector from R to a FORTRAN subroutine. There have been several posts discussing this issue (e.g. http://tolstoy.newcastle.edu.au/R/help/98a/0547.html, http://tolstoy.newcastle.edu.au/R/help/05/10/13558.html, http://tolstoy.newcastle.edu.au/R/help/01a/2577.html, http://tolstoy.newcastle.edu.au/R/help/01c/1795.html,
2007 Dec 09
1
Problems working with large matrix (using package R.huge)
Hi all, Since I was having several problems trying to work with a large matrix I started to use the package R.huge but I'm having the following problem > x<-FileByteMatrix("covtype.data",nrow=581012,ncol=55) Error: cannot allocate vector of size 770.8 Mb In addition: Warning messages: 1: Reached total allocation of 447Mb: see help(memory.size) in: readChar(con = con, nchar =
2002 Apr 26
4
Memory "leak" in readChar (PR#1483)
Full_Name: Hugh C. Pumphrey Version: 1.4.1 OS: Linux (Debian Woody) Submission from: (NULL) (129.215.133.170) The function readChar() appears to have some type of problem with memory allocation. I don't know if "memory leak" is the correct term but if one uses readChar() many times, the R binary grows in size until it eats all your memory and swap space. The code enclosed below
2012 Apr 01
1
scan() vs readChar() speed
Dear list, I am trying to find a fast solution to read moderately large (1 -- 10 million entries) text files containing only tab-delimited numeric values. My test file is the following, nr <- 1000 nc <- 5000 m <- matrix(round(rnorm(nr*nc),3),nr=nr) write.table(m, file = "a.txt", append=FALSE, row.names = FALSE, col.names = FALSE) scan() is faster than
2010 Sep 22
1
help with sockets in R
...;id\":\"some_doc\",\"rev\":\"7-906e06a7744780ef93126adc6f8f10ef\"}\n" when it should be: "{\"ok\":true,\"id\":\"some_doc\",\"rev\":\"7-906e06a7744780ef93126adc6f8f10ef\"}" Is mixing readLines and readChars on the same connection causing bad juju? If it is, what's the recommended what to do such a thing? Thanks for any help!! -Chris
2017 Sep 12
3
Load R data files
Dear All: I am trying to load an R data set, but I got the following message. Please see below. The file is there. setwd("F:/Fall_2017/5-STA574/2-Notes/1-R/1-R_new/chapter4-Entering_Data") datahs0csv <- read.table("hs0.csv", header=T, sep=",") attach(datahs0csv) detach(datahs0csv) rm(list=ls()) Then I tried to reload the data, but I got this error message. I
2005 Nov 03
3
Search within a file
Hi, I am looking for a way to search a file for position of some expression, from within R. My current code: sha1Pos = gregexpr("<sha1>", readChar(filename, file.info(filename)$size))[[1]] Works fine for small files, but text files I will be working with might get up to Gb range, so I was trying to accomplish the same without loading the whole file into R. I realize this is
2024 Feb 17
1
certain pipe() use cases not working in r-devel
I've now tested with: > R.version.string [1] "R Under development (unstable) (2024-02-16 r85931)" and all of the previously mentioned examples now work as expected on macOS. Thanks for the quick fix, Jenny On Thu, Feb 15, 2024 at 8:02?AM Tomas Kalibera <tomas.kalibera at gmail.com> wrote: > > On 2/14/24 23:43, Jennifer Bryan wrote: > > Hello, > > >
2007 Aug 23
3
RData File Specification?
Hi, I am developing a tool for converting a large data frame stored in an uncompressed binary (XDR) RData file to a delimited text file. The data frame is too large to load() and extract rows from on a typical PC. I'm looking to parse through the file and extract individual entries without loading the whole thing into memory. In terms of some C source functions, instead of doing
2024 Feb 14
2
certain pipe() use cases not working in r-devel
Hello, I've noticed a specific type of pipe() usage that works in released R, but not in r-devel. In 4.3.2 on macOS, I can write to a connection returned by pipe(), i.e. "hello, world" prints here: > R.version.string [1] "R version 4.3.2 (2023-10-31)" > con <- pipe("cat") > writeLines("hello, world", con) hello, world But in r-devel on