Displaying 20 results from an estimated 10000 matches similar to: "RE: problem with while loop with next"
2001 Oct 02
1
problem with while loop with next (was RE: file connection, w hile, readLines and browser)
Dear R-help,
I think I have kinda isolated the problem I had to the following:
i <- 0
while( {i <- i + 1} < 5) {
if(i < 3) next
print(i)
}
This seems to go into an infinite loop. After I break the execution, i has
the value 1.
At the R prompt, if I start from i <- 0 and keep typing {i <- i + 1} < 5, it
eventually evaluate to TRUE. So why does the while loop not work?
2001 Oct 02
0
An example (was RE: file connection, while, readLines and bro wser)
Prof. Gentleman (and R-help),
Here's an example of what didn't work. I still don't understand why.
Function:
trycon <- function(file, n) {
f.con <- file(file, open="rt")
on.exit(close(f.con))
i <- 0
while( length(readln <- readLines(f.con, 1)) > 0 ) {
x <- unlist(strsplit(readln, " "))
if(length(x) <= 6 && x[3] ==
2009 Oct 13
1
Iterating over file lines
I am attempting to iterate over a file, processing it line by line.
In my function below, I am only getting the first item over and over
and over again from my test file rather than subsequent lines. How
can I modify this to read lines sequentially?
==
iteratefile <- function(file) {
f.con <- file(file)
on.exit(close(f.con))
while( length(readln <- readLines(f.con, 1)) > 0 ) {
2002 Feb 22
1
c-c problem when R compiled with pthread
Dear R-devel,
I've run into this problem that when I hit c-c to interrupt a command or
computation, the R session just ends.
The info: R-1.4.1 compiled from source on Linux Mandrake 7.1. Dual P-3 Xeon
with 2GB ram.
1. Compiled R with link to Intel Math Kernel Library (for fast BLAS), which
needed pthread. C-c at the R prompt ends the R session.
2. Compiled R with link to (threaded)
2001 Apr 11
1
a couple of ideas/proposals
Byron Ellis has been making some progress on a hdf5 library for
microarray data (and any other thing you want to put in there).
In doing so some issues have arisen that are of more general
interest.
1) hdf5 supports annotation (through comments) so it would be nice
if the comment function in R became generic. I think this is
backward compatible and basically not really an issue of any
2002 Feb 04
1
read zipped files
I received several answer to my querry re reading zipped files,
R.Gentleman, Liaw Andy, BD Ripley,J Holtman, A.Matt, and others,
sorry
if I missed your names.
a- use pipe to run external unzip to a file and read from there
b- use gzfile() to open directly a gzipped file
c- use zip.file.extract()
solution b works like a charm, unfortunately it open gzipped files
and
not zipped files, would it be
2001 Oct 02
0
file connection, while, readLines and browser
Dear R-help,
I have one more question about the functions mentioned in the subject.
Again, the system info is:
platform i386-pc-mingw32
arch x86
os Win32 (OK, it's NT4sp6)
system x86, Win32
status
major 1
minor 3.1
year 2001
month 08
day 31
language R
2006 Dec 29
2
Binary AGI Scripts
Hi Everyone,
I'm wondering if anyone here write AGI's in compiled binaries. I'm
writing a small Cepstral AGI in Freepascal/Lazarus. I know there are
some other AGI's out there, but I wanted to add some more functionality
than what is available such as having the AGI determine if the "data"
argument is plain text or a path to a text file and act accordingly.
The
2002 Jun 12
3
help debugging segfaults
(Sorry for the cross-post--- I wasn't sure which list is more
appropriate...)
Hi everyone,
I've run into segfaults when using my randomForest package on large dataset
(e.g., 100 x 15200) and large number of trees (e.g., ntree=7000 and
mtry=3000). I'm wondering if anyone can give me some hints on where to look
for the problem.
The randomForest package mainly consists of two things:
2002 Jun 12
3
help debugging segfaults
(Sorry for the cross-post--- I wasn't sure which list is more
appropriate...)
Hi everyone,
I've run into segfaults when using my randomForest package on large dataset
(e.g., 100 x 15200) and large number of trees (e.g., ntree=7000 and
mtry=3000). I'm wondering if anyone can give me some hints on where to look
for the problem.
The randomForest package mainly consists of two things:
2002 Apr 23
3
error loading huge .RData
Dear R-help,
I've run into a problem loading .RData: I was running a large computation,
which supposedly produce a large R object. At the end of the session, I did
a save.image() and then quit. The .RData has size 613,249,399 bytes. Now I
can't get R to load this .RData file. Whenever I tried, I get "Error:
vector memory exhausted (limit reached)". I tried adding
2005 Apr 14
2
documentation for 'open': some clarification?
I'm been doing more and more of file text parsing inside R instead of
coping with Perl. For that, I need open a file and read it line-by-line.
I found the documentation for 'open' isn't very clear.
Right now it has
,----[ *help(R)[open]* ]
| 'open' opens a connection. In general functions using connections
| will open them if they are not open, but then close them
2002 Jun 13
3
[R] help debugging segfaults
Hi all,
Thanks to Prof. Ripley, Prof. Gentleman, and Simon Wood (did I miss
anyone?). The problem seemed to have gone away.
Everyone suggested using some malloc debugger (such as Electric Fence). All
I did was following half of what BDR suggested below, i.e., changing all the
S_alloc() calls to Calloc() and Free(). I didn't get to try efence, and the
problem seems to have disappeared!
As
2006 Apr 24
1
Handling large dataset & dataframe [Broadcast]
Here's a skeletal example. Embellish as needed:
p <- 5
n <- 300
set.seed(1)
dat <- cbind(rnorm(n), matrix(runif(n * p), n, p))
write.table(dat, file="c:/temp/big.txt", row=FALSE, col=FALSE)
xtx <- matrix(0, p + 1, p + 1)
xty <- numeric(p + 1)
f <- file("c:/temp/big.txt", open="r")
for (i in 1:3) {
x <- matrix(scan(f, nlines=100), 100,
1997 Aug 06
1
R-beta: ?faq example of scoping
I like Thomas' example. Kurt can you include it in the FAQ.
Recently I have been doing a lot of programming that has required either
optimization or zero-finding. Unfortunately most of the functions need
some arguments to be optimized over and have other parameters that depend on
the data but are fixed with respect to optimization. With R scoping rules
this is a trivial problem; simply
1997 Aug 06
1
R-beta: ?faq example of scoping
I like Thomas' example. Kurt can you include it in the FAQ.
Recently I have been doing a lot of programming that has required either
optimization or zero-finding. Unfortunately most of the functions need
some arguments to be optimized over and have other parameters that depend on
the data but are fixed with respect to optimization. With R scoping rules
this is a trivial problem; simply
2002 Jan 24
2
R-gnome: no way to configure
Hi!
I've been able to configure and make R (1,4,0 linux)
except for the gnome support. I've checked all packages and libs mentioned
in R-admin.pdf (and by Luke Tierny) to make sure that I have them and even
using the following:
./configure --with-gnome --with-gnome-includes=/opt/gnome/include
--with-gnome-libs=/opt/gnome/lib --with-libglade-config=opt/gnome/lib
I still get:
R is now
2003 Aug 26
4
R on Linux/Opteron?
Dear R-help:
Has anyone tried using R on the the AMD Opteron in either 64- or 32-bit
mode? If so, any good/bad experiences, comments, etc? We are considering
getting this hardware, and would like to know if R can run smoothly on such
a beast. Any comment much appreciated.
Best,
Andy
Andy Liaw, PhD
Biometrics Research PO Box 2000, RY33-300
Merck Research Labs Rahway, NJ
2002 Jul 02
4
auto-loading package possible?
Dear R-help,
Yes, I do know about the auto-loading feature. My question is more
complicated than that:
Suppose I loaded a package (e.g., e1071) and created an object of certain
class (e.g., svm), for which there is a print method in the package to hide
things that the user may not need to see (e.g., large vectors or matrices
needed by methods such as predict). If the next time I started R, I
1998 Jun 26
2
scoping
Can Luke Tierney's recent S-new post on scoping be included in the R FAQ?
I'm just going through my package and eliminating a few instances of "eval" as I
hadn't realized the dangers. I noticed that one way I've used eval is for
prompting, as in
n <- eval(parse(prompt="Enter the number of singular values to use: "))
I presume this is not too dangerous, but