search for: textconnect

Displaying 20 results from an estimated 1235 matches for "textconnect".

Did you mean: testconnect
2011 Mar 10
1
about textConnection
I need read a table in a string with special format. I used read.csv and textConnection function. But i am confuse about textConnection by follow code. case A: It is OK£¡ str0 <- '{"abc",{"def","X,1&Y,2&Z,3"}}' str1 <- strsplit(str0,'"')[[1]][6] str2 <- gsub("&","\n", str1) con &lt...
2007 May 15
3
textConnection
hello, I don't understand what's happen just before the textConnection function runs good but now it doesn't run > Line[1] [1] "if C325=. then C743=(C152/C103)*100| else C743=(C152/C325)*100" > textConnection(Line[1]) Erreur dans textConnection(Line[1]) : toutes les connexions sont utilisées why R display that? ________________________...
2002 Jun 21
1
textConnection appears to be slow
I was trying to read in a file and delete lines that did not have the correct number of fields on them. I was reading the file as one character vector per line using 'scan' with sep='\n'. I was then using 'count.fields' with 'textConnection' to the object I just read in. I thought at first the system was locked up, but further testing showed that the 'textConnection' was a very slow way to read in data to 'count.fields' as compared to 'count.fields' just reading the file. Is this a characteristic of us...
2010 Aug 16
2
when to use textConnection ??
Hello. I don't uderstant when to use textConnection and when not. Some examples do it, some not. I've even seen something like con <- textConnection(rev(rev(ReadLines('data.txt'))[-(1:2])) data <- read.table(con) close(con) -- View this message in context: http://r.789695.n4.nabble.com/when-to-use-textConnection-tp2327132p232...
2003 Apr 30
1
textConnection taking a long time to open a big string
I was using 'textConnection' to read in a file with about 11,000 lines so I could detect lines with incomplete data and delete them and then read them in with 'scan'. I am using 1.7.0 on Windows. Here is the output from the script and it was using 51 seconds just to do the textConnection. Is there a limit on...
2010 May 19
1
apparent problems with the textConnection command
...he text :??? c:\Rtools\bin;c:\Rtools\perl\bin;c:\Rtools\MinGW\bin; f1<-file("C:\\Ex\\f1.txt") c1<-readLines(f1,1) c2<-gsub(";",";\n",c1) cat(c2) close(f1) ####### the above code gives exactly the results that I want # next, attempt to read the same text in via textConnection f2<-textConnection("c:\Rtools\bin;c:\Rtools\perl\bin;c:\Rtools\MinGW\bin;") d1<-readLines(f2) ################ The results that I obtained (with an echo of the commands) were : > f1<-file("C:\\Ex\\f1.txt") > c1<-readLines(f1,1) > c1 [1] "c:\\Rtools...
2017 Oct 24
2
read.table(..., header == FALSE, colClasses = <vector with names attribute>)
...mple. The same warning occurs when the 'file' argument points to a file on disk with a million lines. But you are correct, my example was slightly malformed and in fact gives an error under R version 3.2.2. Please allow me to try again; in older versions of R, ?? > read.table(file = textConnection("a\t3.14"), header = FALSE, colClasses = c(x = "character", y = "numeric"), sep="\t") ? ?? V1?? V2 ?? 1? a 3.14 (with no warning). As of version 3.3.0, ?? > read.table(file = textConnection("a\t3.14"), header = FALSE, colClasses = c(x =...
2017 Oct 24
0
read.table(..., header == FALSE, colClasses = <vector with names attribute>)
...the 'file' argument > points to a file on disk with a million lines. But you are correct, my > example was slightly malformed and in fact gives an error under R > version 3.2.2. Please allow me to try again; in older versions of R, > ?? > read.table(file = textConnection("a\t3.14"), header = FALSE, > colClasses = c(x = "character", y = "numeric"), sep="\t") > ? ?? V1?? V2 > ?? 1? a 3.14 > (with no warning). As of version 3.3.0, > ?? > read.table(file = textConnection("a\t3.14&q...
2008 Oct 12
2
proper use of textConnection
Colleagues, Using R2.7.0 in OS X, I am having trouble understanding the command textConnection. My situation is as follows: 1. I am trying to read a lengthy file (45000 lines) that has headers ~ every 1000 lines. read.table (or its variants) fail because of the recurrent headers. 2. My present approach is the following: a. use readLines to read the file, save as an array b. us...
2005 Mar 22
1
I modify my question in "textconnection output"
dear ALL-R-helper: I modify my question in "textconnection output": I wrote one function in Rgui: output <- function(y){ x <- textConnection("foo","w") sink(x) a <-5 b <-6 z <-a*b z e <-"spss" h <-c(1,2,3) ls() r<-c("s","p","s","s") p<-list(1...
2008 Dec 16
0
socket server, textConnection and readLines
Hello; This is bit long email but hope someone can guide me. I have questions regarding socket, readLines and textConnection. I am not sure if my code is efficient (due to textConnection) and how to handle client disconnect and restart of the socket server in R. I have a huge(3.5+G) text file on machine 'A', which I want to process on machine 'B' using read.table (one line or a chunk at a time). On ma...
2017 Aug 09
1
Problem with serialization via readRDS() on a textConnection()
(Sorry for not linking to your message; I accidentally deleted the original copy of your message.) Your code > zz = textConnection('tempConnection', 'wb') > saveRDS(c("a", "b", "c"), zz, ascii = TRUE) > serialized_obj = paste(textConnectionValue(zz), collapse='\n') > readRDS(textConnection(serialized_obj)) Error in gzcon(file) : 'read' not enabled for...
2009 Jul 11
3
Reading data entered within an R program
Dear R-helpers, I know of two ways to reading data within an R program, using textConnection and stdin (demo program below). I've Googled about and looked in several books for comparisons of the two approaches but haven't found anything. Are there any particular advantages or disadvantages to these two approaches? If you were teaching R beginners, which would you present? Thank...
2014 Feb 04
0
capture.output(): Using a rawConnection() [linear] instead of textConnection() [exponential]?
I've noticed that the processing time for the default capture.output() grows exponentially in the number of characters outputted/captured. The default settings sinks to a temporary textConnection(). When instead sinking to a rawConnection(), the processing time becomes linear. See below example and attached PNG figure [also at http://xfer.aroma-project.org/tmp/20140203/capture.output_text-vs-raw.png]. I know little about text encoding, but I wouldn't be surprised I'm overseein...
2005 Sep 18
0
Updated rawConnection() patch
Here's an update of my rawConnection() implementation. In addition to providing a raw version of textConnection(), this fixes two existing issues with textConnection(): one is that the current textConnection() implementation carries around unprotected SEXP pointers, the other is a performance problem due to prolific copying of the output buffer as output is accumulated line by line. This new version uses...
2008 Apr 29
2
reproducible segmentation fault caused by textConnection()
Dear all, It seems that textConnection() can trigger a segmentation fault. The following script (using two large loops) makes this bug reproducible: for (i in 1:10000) { z=textConnection(NULL,open='w') for (j in 1:100) { write(runif(1)*1e6,file=z) write('\n',file=z) } close(z) } The bug could b...
2009 Jan 14
1
publication statistics from Web of Science
...advice on how to present this data better is most welcome. (I should mention that i'd rather not involve any complicated statistical analysis, I only want to make sure that the presentation is not horribly biased). Best regards, baptiste statistics <- list(list(values=read.table(textConnection(" date count 2007 600 2006 588 2008 555 2005 430 2004 418 2003 334 2002 277 2001 239 2000 226 1997 184 1999 184 1998 182 1996 129 1995 108 1994 92 1993 67 1992 53 1991 47 1990 37 1989 14 1988 11 1983 10 1987 7 1985 6 1986 6 1981 5 1984 5 1979 4 1982 4 2009 3 1971 2 1933 1 1973 1 1974 1 1977...
2010 Jun 25
3
gsub with regular expression
If I have a text with 7 words per line and I would like to put first and second word joined in a vector and the rest of words one per column in a matrix how can I do it? First 2 lines of my text file: "2008/12/31 12:23:31 numero 343.233.233 Rodeo Vaca Ruido" "2010/02/01 02:35:31 palabra 111.111.222 abejorro Rodeo Vaca" Results: Vector: 2008/12/31 12:23:31 2010/02/01 02:35:31
2001 Nov 01
1
textConnection
List Members, I am using R 1.3.1 for windows and trying to capture the output of some summaries using textConnection. I then want to incorporate the text with summary graphics output. The code below works (captures the output) when it is not used in a loop or function. When placed in a loop or function, the cat outputs are captured to 'foo' but the summary outputs are not. The help mentions som...
2009 Oct 19
1
source and textConnection
Is this warning given on purpose? > myconn<-textConnection("print(11*11)") > source(myconn) [1] 121 Warning message: In source(myconn) : argument 'encoding = "native.enc"' will be ignored Could it be omitted, since the docs state that encoding is only use if the corresponding argument is a file name or url? -- Eric...