similar to: readChar() could read the whole file by default?

Displaying 20 results from an estimated 5000 matches similar to: "readChar() could read the whole file by default?"

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
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
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:
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
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"
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
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,
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
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
2010 Sep 22
1
help with sockets in R
Hi R gurus, I'm trying to use a ReSTful web service from within R. Specifically, I need to make HTTP PUT requests. I'm able to make the request and that goes well enough, but I'm having trouble properly consuming the HTTP response. The problem comes in when I'm trying to parse out the response body. I get the length of the response body from the Content-Length header. I then try
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,
2010 May 05
1
handling nulls while reading mainframe file
Hi, I am trying to read in records from an old main frame file. Each record is 640 bytes. I had some success using the following statement: iconv(readChar(con, nchars=640, useBytes = TRUE),from="IBM037",to="",sub="#") What I have found, however, is that ocassionally a record will contain a Null halfway through, which causes readChar() not to read the rest of the
2017 Dec 19
1
Xen PV DomU running Kernel 4.14.5-1.el7.elrepo.x86_64: xl -v vcpu-set <domU> <val> triggers domU kernel WARNING, then domU becomes unresponsive
There are a couple of xen updates in the 4.9.66 and 4.9.68 kernels: https://cdn.kernel.org/pub/linux/kernel/v4.x/ChangeLog-4.9.66 https://cdn.kernel.org/pub/linux/kernel/v4.x/ChangeLog-4.9.68 Let me build a newer Dom0 kernel and see if that helps. Thanks, Johnny Hughes On 12/11/2017 06:52 PM, Adi Pircalabu wrote: > Has anyone seen this recently? I couldn't replicate it on: > -
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 =
2017 Dec 12
5
Xen PV DomU running Kernel 4.14.5-1.el7.elrepo.x86_64: xl -v vcpu-set <domU> <val> triggers domU kernel WARNING, then domU becomes unresponsive
Has anyone seen this recently? I couldn't replicate it on: - CentOS 6 running kernel-2.6.32-696.16.1.el6.x86_64, kernel-lt-4.4.105-1.el6.elrepo.x86_64 - CentOS 7 running 4.9.67-1.el7.centos.x86_64 But I can replicate it consistently running "xl -v vcpu-set <domU> <val>" on: - CentOS 6 running 4.14.5-1.el6.elrepo.x86_64 - CentOS 7 running 4.14.5-1.el7.elrepo.x86_64
2006 Oct 23
6
nested if/else very slow, more efficient ways?
Hello, in the data.frame "resultsfuzzy" I would like to replace the characters in the second column ("5a", "5b", ... "5e") with numbers from 1 to 5. The data.frame has 39150 entries. I seems to work on samples that are << nrow(resultsfuzzy) but it takes suspicously long. Do you have any suggestions how to make the character replacing more
2023 May 30
1
[syzbot] [kvm?] [net?] [virt?] general protection fault in vhost_work_queue
On Tue, May 30, 2023 at 12:30:06AM -0700, syzbot wrote: > Hello, > > syzbot found the following issue on: > > HEAD commit: 933174ae28ba Merge tag 'spi-fix-v6.4-rc3' of git://git.ker.. > git tree: upstream > console output: https://syzkaller.appspot.com/x/log.txt?x=138d4ae5280000 > kernel config: https://syzkaller.appspot.com/x/.config?x=f389ffdf4e9ba3f0
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
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, > > >