Search Archives
Search tips
from:Name
Search by author name, e.g. from:Duncan Murdoch
"exact phrase"
Match an exact phrase
word1 word2
Match messages containing both words
Date range
Use the date pickers to filter results to a time period
Use the list dropdown to narrow results to a specific mailing list. Combine from: with other terms to filter by author and content.
Hi all, what's the way to check for this? I know of "file.exists," but that does not preclude the possibility of an empty file. Thanks very much!
Hi, how do I delete a component from a list? For example, aaa <- list(), aaa$a <- 0, aaa$b <- 0. How do I remove aaa$a from aaa so that it's left with aaa$b? Thanks very much.
Hi, how do I sink output to a subdirectory under which R is running? For example, suppose R is running in ~me and I would like to sink output to ~me/Subdir/filename. The obvious sink( "Subdir/filename" ) does not...
Hi, how would I plot two series in the same plot, but with two y-axes (one on the left and one on the right)? Would this be possible? [The two series have quite different y-values, so using the...
Hi, I can't seem to get an answer for this by searching through the R-help archives: How does one remove leading brackets in print? For example, >print( 3 ) >[1] 3 Would it be possible to get rid of...
Hi all, is there a way to read a data file into R line-by-line, akin to what fscanf does in C, say? It seems that "scan" and "read.table" both read the entire data file in at once...
Ah, thanks! (It's not that I didn't reading it -- I didn't understand it and so I thought that it'd be easier to ask again. Thanks very much!) >From: Peter Dalgaard BSA <p.dalgaard at biostat.ku...
Apologies for asking about this, but I don't quite understand how this works after looking through the FAQ and the Help archives. Let's say I want to pass "1000" as an argument to R. I did the following...
I'm afraid that I don't have your new book with Venables handy. So would it be fair to assume that there's no real need to avoid loops these days? Thanks again. >From: Prof Brian Ripley <ripley at...
Sorry, my fault. I was actually in Subdir while attempting this. Thanks very much. >From: Prof Brian Ripley <ripley at stats.ox.ac.uk> >To: R A F <raf1729 at hotmail.com> >CC: r-help at r-project.org >Subject...
Maybe I'm missing something. When I do readLines( "file", n = 1) and repeat, it always reads the first line of "file". I've to be able to advance to the next line, no? I'll take a look at...
Hi, I'm facing this problem quite a lot, so it seems worthwhile to check to see what the most efficient solution is. I've two vectors x (values ordered) and y. I've ranges x < x0, x0 <= x < x1...
Interesting. The other day I was surprised by how much longer a for loop takes to add two vectors a and b compared to a + b. (I think that I made a and b have a million entries.) I guess...
Hi, I'm faced with the following problem and would appreciate some advice. I could have a data frame x that looks like this: aa bb a 1 "A" b 2 "B" The advantage of this is that I could...
Thanks very much. I guess the answer leads to more questions: (a) What if I don't know the number of lines? So I would like to use a while loop until readLines hits an EOF character. Would that be...
Hi, this question is meant to be a bit vague, since I'm really not familiar with all the issues involved. It's also a problem that I think many would have encountered and would have useful suggestions. According to...
For what it's worth, I followed the suggestion of using colClasses: cls <- c( "numeric", "character", "numeric", "numeric", "numeric" ) system.time( bbb <- read.table( "file", colClasses = cls ) ) Here're the results from three tries: 8.21 0.06 8.28...
I'm sorry to have to ask another question related to this. What if the lines have variable number of fields? For example, all I know is that each line starts with double, string, double, say, but some lines may...
Hi all, thanks to everyone again for helping out. I don't want to generate too many messages, but this problem seems common enough that maybe it's worth a summary. What I can do is this. Let's say...
Thanks for your comments. I'm not too familiar with these differences, but here's a simple experiment. In a data file with 139,000 rows and 5 columns (double string double double double), >system.time( aaa <- read.table( "file...
Can't find what you're looking for? Try searching with Google .