Displaying 20 results from an estimated 10000 matches similar to: "subscripting a column from a data frame: row.names are dropped"
2002 Dec 19
1
disabling NA token as na.string in read.table
Dear R-Users,
I have a csv file that has NA tokens and these tokens are perfectly good
values that need not to be converted to NA by read.table(). I tried to
prevent the conversion by specifying the na.strings arg., but this seems to
only add to the list of NA strings, not substitute.
> system("cat foo")
system("cat foo")
1 foo
2 NA
> read.table("foo",
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
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"
2002 Jun 28
1
browser/debug and for loop
Dear R-Users,
It seems like once one invokes browser() inside a loop and steps through the
body using 'n' any subsequent loop will be "intercepted" by debug()
function. Here is exactly what I mean
# fresh R session
# run a loop that has browser() inside the body
> for (i in seq(5)) { browser(); print(i) }
for (i in seq(5)) { browser(); print(i) }
Called from: NULL
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
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} -
2003 Mar 11
2
system(..., intern=TRUE) splits long lines (PR#2623)
system(..., intern=TRUE) splits long lines after 118th character and
discards the 119th character
> a <- paste(rep("a", 124), collapse="")
> system(paste("echo", a), intern=TRUE)
system(paste("echo", a), intern=TRUE)
[1]
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
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 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
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
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
2009 Jul 21
1
subscript into matrix discards row/column names
Dear R-help,
When the result of a matrix subscription degenerates to a scalar the names implied by the dimnames are discarded.
> x <- matrix(0, 1, 1, dimnames=list('a', 'x'))
## below I expected result to have names='x', it's not
> x[1,]
[1] 0
## below I expected result to have names='a', it's not
> x[,1]
[1] 0
This is probably a side effect
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
2001 Nov 06
1
RPM digital signature
I thought I'd install the binary RPM for Red Hat 7.1. Following the advice
from the ReadMe I checked the GPG signature (sorry, I have very little idea
what it is) of the .rpm files. Here is what I got.
% rpm --checksig *.rpm
R-base-1.3.1-3.i386.rpm: md5 GPG NOT OK
R-recommended-1.3.1-1.i386.rpm: md5 (GPG) OK (MISSING KEYS: GPG#97D3544E)
Does it indicate any problem?
Thanks, Vadim
2002 Dec 02
1
readLines() changes mode of connection
Hi,
It seems like reading a line from a gzfile() connection changes the mode of
the connection from text to binary (it also alters "can write", in case it
matters). The following transcript, produced on RedHat 7.1, demonstrates
this "feature" (note the evolution of file$text). Is this expected?
Thanks, Vadim
> file <- gzfile("foo.gz")
file <-
2002 Jan 03
1
skipping fields in scan()
Dear R-Users,
Is it possible to instruct scan() to skip fields when reading from a file.
Here is an example. Suppose I have a three-column table file, "foo"
1 2 3
4 5 6
and I want to read in only the first and the third columns skipping the
second. If memory serves me well (though I might be wrong), in S-Plus you
could accomplish this by putting NULL in the respective position of the
2005 Apr 03
1
Error: NAs are not allowed in subscripted assignments: change from R.1.9
Hi,
There seems to be a change in 2.0.1 in the workings of subscript
assignments with missing values.
# This is R.2.0.1
# assignment w/ missing index doesn't work when right-hand-side is a
matrix. It did work in 1.9.1
> x = matrix(1, 2, 2); x[c(1,NA),] = x
Error: NAs are not allowed in subscripted assignments
# it does work for a vector
> x = matrix(1, 2, 2); x[c(1,NA),] = 1
Is this
2001 Nov 23
4
SQL implementations (was: Are you experienced in SAS and R ...)
An embedded message was scrubbed...
From: Douglas Bates <bates at stat.wisc.edu>
Subject: Re: [R] Are you experienced in SAS and R as well? Which of these would you recommend me?
Date: 23 Nov 2001 15:16:59 -0600
Size: 4446
Url: https://stat.ethz.ch/pipermail/r-help/attachments/20011123/8d0399f0/attachment.mht
2002 Aug 09
1
LM: Least Squares on Large Datasets OR why lm() is designed the w ay it is
Hi,
I have always been wondering why S-Plus/R can not fit a linear model to an
arbitrary large data set given that, I thought, it should be pretty
straightforward. Sometime ago I came across a reference to LM package,
http://www.econ.uiuc.edu/~anovo/LM.html, by Roger Koenker and Alvaro Novo.
So I thought here it is at last, but to my surprise this project hasn't made
to the recommended
2004 Mar 02
2
row.names are dropped when extracting one column ?
Apparently row names are dropped when I extract
single column from a data frame. Why this behaviour ?
> y <- as.matrix(df[,1:2]); length(row.names(y))
[1] 324
> y <- as.matrix(df[,1:1]); length(row.names(y))
[1] 0
Best regards,
Ryszard