Displaying 20 results from an estimated 4000 matches similar to: "data frame subscription operator"
2008 Jul 01
1
[.data.frame speedup
Below is a version of [.data.frame that is faster
for subscripting rows of large data frames; it avoids calling
duplicated(rows)
if there is no need to check for duplicate row names, when:
i is logical
attr(x, "dup.row.names") is not NULL (S+ compatibility)
i is numeric and negative
i is strictly increasing
"[.data.frame" <-
function (x, i, j,
2023 Dec 16
2
Partial matching performance in data frame rownames using [
On Wed, 13 Dec 2023 09:04:18 +0100
Hilmar Berger via R-devel <r-devel at r-project.org> wrote:
> Still, I feel that default partial matching cripples the functionality
> of data.frame for larger tables.
Changing the default now would require a long deprecation cycle to give
everyone who uses `[.data.frame` and relies on partial matching
(whether they know it or not) enough time to
2023 Dec 19
1
Partial matching performance in data frame rownames using [
Hi Hilmar and Ivan,
I have used your code examples to write a blog post about this topic,
which has figures that show the asymptotic time complexity of the
various approaches,
https://tdhock.github.io/blog/2023/df-partial-match/
The asymptotic complexity of partial matching appears to be quadratic
O(N^2) whereas the other approaches are asymptotically faster: linear
O(N) or log-linear O(N log N).
2013 Dec 05
0
S4 method for '[' with extra arguments: distinguishing between x[i] and x[i, ]
Hi,
I want to implement a '[' for an S4 class, that behaves differently
when called with a single index argument or multiple indexes (possibly
missing), like what happens when subsetting matrices x[i] vs. x[i, ].
I manage to do it using nargs() and checking if drop is missing (see
code below), but when I want to add an extra argument to the method
(before drop), then the parent call
2006 Dec 08
1
empty pages in xyplot (2.4.0)
In 2.4.0 (and SVN) I am seeing xyplot creating empty pages for high page
counts in layout - contrary to the manual which says high page counts should
not matter. Everything works fine in 2.3.1.
library("lattice")
A<-data.frame(x=1:10, y=sin(1:10), z=round(1:10/3))
xyplot(x~y|z, A, layout=c(1,1,10))
The snippet above produces a valid plot in R 2.3.1, while in 2.4.0 and later I
see
2006 Oct 31
1
Some R questions
Hi all,
I am working with some large data sets (1-4 GB) and have some questions
that I hope someone can help me with:
1. Is there a way to turn off garbage collector from within C interface ?
what I am trying to do is suck data from mysql (using my own C
functions) and I see that allocating each column (with about 1-4 million
items) takes between 0.5 and 1 seconds. My
2002 Oct 25
0
[., multiple inheritance, and R 1.6
Matt Nelson <MNelson at sequenom.com> reported a problem using the Hmisc library that did not occur with versions of R before 1.6. I am running
platform i686-pc-linux-gnu
arch i686
os linux-gnu
system i686, linux-gnu
status
major 1
minor 6.0
year 2002
month 10
day 01
language R
> library(Hmisc)
> g <-
2006 Dec 02
0
fixup for debug package and R2.4.0
A number of users have spotted a terminal problem with the 'debug' package under R2.4.0, along the lines of
> mtrace(x)
> x()
Error in attr(value, "row.names") <- rlabs :
row names must be 'character' or 'integer', not 'double'
This arose from a bug in 'rbind.data.frame' in R2.4.0 itself. The bug is fixed in R2.4.0 patched, so the
2007 Jan 12
0
Minor logical bug in rbind.data.frame ?
When attempting to merge 3 data frames, one of which has fewer columns
than the others, rbind.data.frame correctly refuses to perform the bind.
However, the error message given is a bit obscure due to a logical
bug in the match.names() internal function to rbind.data.frame.
Illustration:
## Three data frames with same column variable names:
> foo <- data.frame(v1 = c('a',
2023 Dec 13
1
Partial matching performance in data frame rownames using [
Dear Ivan,
thanks a lot, that is helpful.
Still, I feel that default partial matching cripples the functionality
of data.frame for larger tables.
Thanks again and best regards
Hilmar
On 12.12.23 13:55, Ivan Krylov wrote:
> ? Mon, 11 Dec 2023 21:11:48 +0100
> Hilmar Berger via R-devel <r-devel at r-project.org> ?????:
>
>> What was unexpected is that in this case was that
2010 May 14
2
Subscripting a matrix-like object
I have an S3 class called "tis" (Time Indexed Series) which may or may
not have multiple columns. I have a function "[<-.tis" that I've
reproduced below.
My question is this: inside of "[<-.tis", how can I distinguish between
calls of the form
x[i] <- someValue
and
x[i,] <- someValue ?
In either case, nargs() is 3, and looking at the values
2010 May 14
2
Subscripting a matrix-like object
I have an S3 class called "tis" (Time Indexed Series) which may or may
not have multiple columns. I have a function "[<-.tis" that I've
reproduced below.
My question is this: inside of "[<-.tis", how can I distinguish between
calls of the form
x[i] <- someValue
and
x[i,] <- someValue ?
In either case, nargs() is 3, and looking at the values
2004 Jan 30
0
Two apparent bugs in aov(y~ *** -1 + Error(***)), with suggested (PR#6510)
I think there are two bugs in aov() that shows up when the right hand
side of `formula' contains both `-1' and an Error() term, e.g.,
aov(y ~ a + b - 1 + Error(c), ...). Without `-1' or `Error()' there
is no problem. I've included and example, and the source of aov()
with suggested fixes below.
The first bug (labeled BUG 1 below) creates an extra, empty stratum
inside
2009 Oct 29
3
Weird error: Error in xj[i] : invalid subscript type 'list'
I got the error. I haven't been able to get a stand along case so that
I can show it here. But could somebody give some clue on what could
cause this error? Since I never defined xj[i], I don't understand
where this error come from.
Error in xj[i] : invalid subscript type 'list'
2004 Feb 02
0
Two apparent bugs in aov(y~ *** -1 + Error(***)), with (PR#6520)
I believe you are right, but can you please explain why anyone would want
to fit this model? It differs only in the coding from
aov(y ~ a + b + Error(c), data=test.df)
and merely lumps together the top two strata.
There is a much simpler fix: in the line
if(intercept) nmstrata <- c("(Intercept)", nmstrata)
remove the condition (and drop the empty stratum later if you
2010 Feb 25
1
error in lmLists in lme4 package (bug?)
Hello,
I am trying to use lmLists in the lme4 package and copying over very
standard code from the nlme package given in 'Mixed-Effects Models in S
and S-Plus'. It appears to not accept an 'I(age-11)' in the formula,
though it will accept the formula with out the subtraction of 11 from
age. This seems like it would be a bug, since this is standard formula
syntax, unless
2009 Oct 14
1
using mapply to avoid loops
Hello, I would like to use mapply to avoid using a loop but for some reason, I can't seem to get it to work. I've included copies of my code below. The first set of code uses a loop (and it works fine), and the second set of code attempts to use mapply but I get a "subscript out of bounds" error. Any guidance would be greatly appreciated. Xj, Yj, and Wj are also lists, and s2,
2019 Mar 01
0
Bug: as.matrix.data.frame() treats numeric vectors with "levels" attribute as factors
Hello,
I think I've found a bug in as.matrix.data.frame().? The function's
documentation says: "The method for data frames will return a character
matrix if there is only atomic columns and any
non-(numeric/logical/complex) column, applying as.vector to factors and
format to other non-character columns. Otherwise, the usual coercion
hierarchy (logical < integer < double
2004 May 24
1
as.matrix.data.frame() in R 1.9.0 converts to character when it should (?) convert to numeric
Conversion of a data frame to a matrix using as.matrix() when a
column of the data frame is POSIXt and all other columns are numeric
has changed in R 1.9.0 from R 1.8.1. The new behavior issues a
warning message and converts to a character matrix. In R 1.8.1, such
an object was converted to a numeric matrix.
Here is an example.
#### R 1.9.0 ####
> foo <- data.frame(
2002 Oct 09
1
problems with missing values created by conversion using as.matri (PR#2130)
> version
_
platform sparc-sun-solaris2.8
arch sparc
os solaris2.8
system sparc, solaris2.8
status
major 1
minor 6.0
year 2002
month 10
day 01
language R