search for: textconnection

Displaying 20 results from an estimated 219 matches for "textconnection".

2007 May 15
4
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? ______________...
2017 Oct 24
1
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&quot...
2017 Oct 24
1
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 = &q...
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 th...
2009 May 16
5
newbie: closing unused connection + readline
...server = TRUE, blocking = TRUE, open = "r", encoding = getOption("encoding") ); # now read each record and split/validate it using read.table repeat { # here for each line I am opening new connection! how to avoid it? line.raw <- textConnection(readLines( reader.socket, n = 1, ok = TRUE)); line.raw <- read.table(line.raw, sep=","); if ( length(line.raw) < 1) break; print (showConnections()); print(warnings()); }
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
2017 Aug 08
0
Problem with serialization via readRDS() on a textConnection()
...ad working code under R v3.2 that serialized an object, stored the serialized object in a database, and then successfully retrieved and hydrated that object. I recently updated to R v3.4.1 and the same code now fails. Here is the code in question (simplified), and the resulting error: > 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 this...
2011 Apr 27
1
read.table: fill=T for header?
...mn - except for the header line. As explained in the help page, read.delim now assumes that the first column contains the row.names (which is not even wrong) but now and all col.names get shiftet by one column. Example: infile <- ''sample\tx1\n1\tA\t\n2\tB\t\n3\tA\t'' read.delim(textConnection(infile)) sample x1 1 A NA 2 B NA 3 A NA So I set row.names to NULL because the man page said "Using ?row.names = NULL? forces row numbering.". Now the row.names really are numbered automatically but I get a "bonus column": read.delim(textConnection(inf...
2018 Feb 25
2
include
Hi Val, My fault - I assumed that the NA would be first in the result produced by "unique": mydat <- read.table(textConnection("Col1 Col2 col3 Z1 K1 K2 Z2 NA NA Z3 X1 NA Z4 Y1 W1"),header = TRUE,stringsAsFactors=FALSE) val23<-unique(unlist(mydat[,c("Col2","col3")])) napos<-which(is.na(val23)) preval<-data.frame(Col1=val23[-napos], Col2=NA,col3=NA) mydat<-rbind(preval,mydat) mydat[...
2007 Mar 01
4
Query about data manipulation
Hi Thanks much for the prompt response to my earlier enquiry on packages for regression analyses. Along the same topic(?), I have another question about which I could use some input. I am retreiving data from a MySQL database using RODBC. The table has many BLOB columns and each BLOB column has data in the format "id1 \t id2 \t measure \n id3 \t id4 \t measure...." (i.e. multiple rows
2018 Feb 25
1
include
HI Jim and all, I want to put one more condition. Include col2 and col3 if they are not in col1. Here is the data mydat <- read.table(textConnection("Col1 Col2 col3 K2 X1 NA Z1 K1 K2 Z2 NA NA Z3 X1 NA Z4 Y1 W1"),header = TRUE,stringsAsFactors=FALSE) The desired out put would be Col1 Col2 col3 1 X1 0 0 2 K1 0 0 3 Y1 0 0 4 W1 0 0 6 K2 X1 0 7 Z1 K1 K2 8 Z2 0 0 9 Z3 X1...
2018 Feb 25
1
include
...Sent from my phone. Please excuse my brevity. On February 25, 2018 7:55:55 AM PST, Val <valkremk at gmail.com> wrote: >HI Jim and all, > >I want to put one more condition. Include col2 and col3 if they are >not >in col1. > >Here is the data >mydat <- read.table(textConnection("Col1 Col2 col3 >K2 X1 NA >Z1 K1 K2 >Z2 NA NA >Z3 X1 NA >Z4 Y1 W1"),header = TRUE,stringsAsFactors=FALSE) > >The desired out put would be > > Col1 Col2 col3 >1 X1 0 0 >2 K1 0 0 >3 Y1 0 0 >4 W1 0 0 >6 K2 X1...
2009 May 29
25
IP-Address
Hi, Is there any way to sort a tabel with a colum with IP-address? table: id rank color status ip 138 29746 yellow no 162.131.58.26 138 29746 red yes 162.131.58.16 138 29746 blue yes 162.131.58.10 138 29746 red no 162.131.58.17 138 29746 yellow no 162.131.58.14 138 29746 red no 162.131.58.13 138 29746 yellow no 162.132.58.15 139 29746 green no 162.252.20.69 140 29746 red yes
2018 Feb 25
1
include
...Z3 X1 <NA> 9 Z4 Y1 W1 On Sat, Feb 24, 2018 at 6:18 PM, Jim Lemon <drjimlemon at gmail.com> wrote: > hi Val, > Your problem seems to be that the data are read in as a factor. The > simplest way I can think of to get around this is: > > mydat <- read.table(textConnection("Col1 Col2 col3 > Z1 K1 K2 > Z2 NA NA > Z3 X1 NA > Z4 Y1 W1"),header = TRUE,stringsAsFactors=FALSE) > preval<-data.frame(Col1=unique(unlist(mydat[,c("Col2","col3")]))[-1], > Col2=NA,col3=NA) > rbind(preval,mydat) > mydat[is.na(mydat)]<-&q...
2012 Apr 27
4
kiteChart to show real values with scalebar
Dear R-users I hope someone could help me on this problem. I want to create a multiple kiteChart showing the real values with a scalebar on each indicating the scale . Here are some sample data to show what I want to achieve. Y <- read.table(textConnection("Sample1 Sample2 60 20 150 50 300 100"),header=TRUE) X <- read.table(textConnection("Sample1 Sample2 6 2 15 5...
2012 Jan 16
6
ggplot- using geom_point and geom_line at the same time
Hi I am plotting line chart using ggplot and want to use geom_line and geom_point simultaneously. I get the plot but now I have two legends. None of the legend is representing the true values. I need the legend with shape and color both. Thanks > con = textConnection("inputs var1 var2 var3+ 100 10 5 2+ 1000 20 10 4+ 5000 30 15 8+ 10000 40 20 16+ 30000 50 25 32")> data = read.table(con, header=TRUE)> data inputs var1 var2 var3 1 100 10 5 2 2 1000 20 10 4 3 5000 30 15 8 4 10000 40 20 16 5 30000 50 25 32...
2018 Feb 25
1
include
hi Val, Your problem seems to be that the data are read in as a factor. The simplest way I can think of to get around this is: mydat <- read.table(textConnection("Col1 Col2 col3 Z1 K1 K2 Z2 NA NA Z3 X1 NA Z4 Y1 W1"),header = TRUE,stringsAsFactors=FALSE) preval<-data.frame(Col1=unique(unlist(mydat[,c("Col2","col3")]))[-1], Col2=NA,col3=NA) rbind(preval,mydat) mydat[is.na(mydat)]<-"0" Jiim On Sun, Feb 25, 2018...
2012 Dec 13
3
Combined Marimekko/heatmap
Hi all, I''m trying to figure out a way to create a data graphic that I haven''t ever seen an example of before, but hopefully there''s an R package out there for it. The idea is to essentially create a heatmap, but to allow each column and/or row to be a different width, rather than having uniform column and row height. This is sort of like a Marimekko chart in
2002 Jul 12
1
Sweave problem with recursive call, Add.
This diff would be better. Gunnar -------------- next part -------------- 268a269,270 > > ocf <- character() 285,286c287,298 < < tmpcon <- textConnection("output", "w") --- > > options(warn=-1) > if (is.finite(max(as.integer(sub("output","",apropos("output"))),na.rm=TRUE))) { > oc <- max(as.integer(sub("output","",apropos("out...
2010 Dec 10
1
Stricter read.table?
read.table gives idiosyncratic results when the input is formatted strangely, for example: read.table(textConnection("a''b\nc''d\n"),header=FALSE,fill=TRUE,sep="",quote="''") => "c''d" "a''b" "c''d" read.table(textConnection("a''b\nc''d\nf''\n''\n"),header=FAL...