similar to: readLines() changes mode of connection

Displaying 20 results from an estimated 10000 matches similar to: "readLines() changes mode of connection"

2008 Mar 07
2
Problems installing packages using the inbuilt facility: "Error i n gzfile(file, "r") : unable to open connection"
Hi I have been trawling the web, FAQs, and R manuals for help on the following issue, but have failed and was wondering if anyone has a solution to the following problem: After having installed R 2.6.2 for Windows (binary), I tried to install various packages. Every time I try loading a package (any package) via the built-in menu, I run into the following error message. >
2005 Dec 09
1
local source packages install from within R session - cross-platform
I realize that others have struggled with this issue...i.e. http://tolstoy.newcastle.edu.au/~rking/R/help/05/01/9826.html i am on os.x 10.4 w/ R2.2, and am (perhaps foolishly) also on this quest... i would like to be able to install downloaded source (tar.gz'd) files from within an R session, and have it work in a X-platform way..i am often not connected to the internet and have libraries
2018 May 10
2
readLines() behaves differently for gzfile connection
When I read a .gz file with readLines() in 3.4.3, it returns text (and a warning). In 3.5.0, it gives a warning, but no text. Is this expected behavior or a bug? 3.4.3: > source_file = "1k_annotation.gz" > readfile_con <- gzfile(source_file, "r") > readLines(readfile_con, n = 5) [1] "#chr\tpos\tref\talt\t <truncated output here> Warning message: In
2018 May 10
1
readLines() behaves differently for gzfile connection
You bet - it's available on github at https://github.com/UW-GAC/wgsaparsr/blob/master/tests/testthat/1k_annotation.gz -Ben On Thu, May 10, 2018 at 4:17 PM, Michael Lawrence <lawrence.michael at gene.com > wrote: > Would it be possible to get that file or a representative subset of it > somewhere so that I can reproduce this? > > Thanks, > Michael > > On Thu, May
2001 Nov 26
3
Doing things with POSIXt
Dear R-Users, I have a data file with timestamps and I wanted to use POSIXct time data type to represent the respective column. I played around with the type and found a couple of issues: * there seems to be no direct way of reading datetimes into a variable. Let's say this is my file "1992-02-27 23:03:20 PST" "1992-02-27 22:29:56 PST" "1992-01-14 01:03:30 PST"
2001 Jul 20
3
estimation of drift of continuous random walk
Dear R-Users, I have the following problem to solve and I wonder if there are means in R that can help me. At irregular time intervals I observe a random walk process, Y, with time-varying drift. I assume that the drift, D, is a (linear) function of some parameter X. The goal is to estimate D(X). I could regress Y_{t+dt} - Y_{t} ~ X, but it's probably not appropriate since Var(Y_{t+dt} -
2002 Dec 05
1
writing to gzfile: segmentation fault (PR#2347)
Full_Name: Vadim Ogranovich Version: Version 1.6.0 (2002-10-01) OS: Red Hat 7.1 Submission from: (NULL) (209.99.241.1) The following sequence of commands crashes my R session. The first weirdness happens after the second command that appears not to change the "foo.gz" file, no error generated. > con <- gzfile("foo.gz", open="w"); cat("goo\n",
2002 Jul 13
3
mutable objects
Hi, I need "mutable" objects that I can safely modify in my C code. All call interfaces, e.g. .C, .Call, etc., require you to not modify the "in" args. The description of the OOP package in R-news from Sep 2001 alludes to a possiblity of such objects, but the package itself is no longer on Omegahat and I am not sure I need the full machinery. Thanks, Vadim P.S. I wonder
2002 Nov 11
2
listing objects loaded by load()
Hi, Is there a direct way of listing objects loaded by load() command? I worked around by loading into a new environment and then ls() of that environment, but I wonder if there is a simpler way. Thanks, Vadim -------------------------------------------------- DISCLAIMER This e-mail, and any attachments thereto, is intended only for use by the addressee(s) named herein and may contain legally
2002 Apr 29
2
calling optim from external C/C++ program
Hi, Does anyone have an example of calling optim() from a standalone C/C++ program? If possible please include the linker options (I am using gcc version 2.96 20000731 (Red Hat Linux 7.1 2.96-98)) Thanks, Vadim -------------------------------------------------- DISCLAIMER This e-mail, and any attachments thereto, is intended only for use by the addressee(s) named herein and may contain
2001 Oct 27
2
"unloading" data
Dear R-Users, I am reading the "An Introduction to R" manual and have come across data() function for loading data. I assume that R requires explicit loading of data objects to save memory. Then I'd expect there should be a function that can unload the objects once they are not needed anymore, what is this function? It would be helpful if ?data contained a reference to that
2002 Sep 03
1
predict.lm with missing data
Dear R-Users, Say I have a data frame 'data' with missing values and I fit > data.lm <- lm(y~x, data=data, na.action=na.omit) Now I want to compute predictions for each observation of 'data' (having NA where the data was missing). The straightforward predict(data.lm) is not good since it produces a vector that is shorter than the number of rows in data (because of the
2001 Sep 17
3
computational capacity of Linux network
Hi, This is not an R question per ce, but I feel like this is a right community to ask it. As a part of our work we run a lot of non-interactive computational jobs. To increase the throughput we would like to distribute the load over the entire network and we are looking at Linux network as a platform. Ideally we would like to be able to submit a job to the network, rather than to a computer, and
2015 Nov 06
2
corrupt PACKAGES.gz?
Is it just me, or did a corrupt PACKAGES.gz file get installed in the bin/windows/contrib/3.2 directory of CRAN mirrors recently? gzfile() complains about it and Cygwin's gzip cannot decompress it. I tried the following repos <- "https://cran.rstudio.com" v <- "3.2" pkgs.gz <- paste(sep="/", repos, "bin/windows/contrib", v,
2007 Dec 19
1
unexpected behavior from gzfile and unz
I get unexpected behavior from "readLines()" and "scan()" depending on how the file is opened with "gzfile" or "unz". More specifically: > file <- gzfile("file.gz") > readLines(file,1) [1] "a\tb\tc" > readLines(file,1) [1] "a\tb\tc" > close(file) It seems that the stream is rewound between calls to readLines.
2003 Feb 19
4
fitting a curve according to a custom loss function
Dear R-Users, I need to find a smooth function f() and coefficients a_i that give the best fit to y ~ a_0 + a_1*f(x_1) + a_2*f(x_2) Note that it is the same non-linear transformation f() that is applied to both x_1 and x_2. So my first question is how can I do it in R? A more general question is this: suppose I have a utility function U(a_i, f()), where f() is say a spline. Is there a general
2008 Apr 20
1
How to read last (incomplete) line from gzfile()?
Hi, I have some text files that do not have trailing \n on the last (incomplete) line; how do I read in the last line? e.g. here is a test case: [linux + R version 2.6.1 (2007-11-26) ] z <- gzfile("short.gz", open="w") cat("7\n5\n3", file=z) close(z) z <- gzfile('short.gz') readLines(z) [1] "7" "5" readLines would indicate that
2005 Aug 25
1
how to close connections?
Hi everybody, I am using gzipped files quite extensively and cannot figure out how I can close (or reuse) connections. Example: > for(i in 1:300) {cat(i, "\n"); a <- readLines(gzfile("file.gz"), n=1) } 1 2 ... 46 47 Error in gzfile("~/tyyq/andmebaasiq/ETU/ETU1997.tsv.gz") : all connections are in use To use just gzfile without any open/close should
2018 May 10
0
readLines() behaves differently for gzfile connection
Would it be possible to get that file or a representative subset of it somewhere so that I can reproduce this? Thanks, Michael On Thu, May 10, 2018 at 3:31 PM, Ben Heavner <bheavner at gmail.com> wrote: > When I read a .gz file with readLines() in 3.4.3, it returns text (and a > warning). In 3.5.0, it gives a warning, but no text. Is this expected > behavior or a bug? > >
2002 Nov 27
1
read.table: colClasses when num. of columns is unknown
Hi, I am looking for a way to read tables that have general structure of characterTag num1 num2 ... i.e. one character column followed by an unknown to the caller (but fixed throughout the file) number of numeric columns. I wanted to improve the speed of read.table by using colClasses, but that seemed to require knowledge of the actual number of columns in the file. For example I tried