similar to: fast subsetting of lists in lists

Displaying 20 results from an estimated 5000 matches similar to: "fast subsetting of lists in lists"

2010 Nov 18
3
problems subsetting
Dear all, I have searched the forums for an answer - and there is plenty of questions along the same line - but none of the paproaches shown worked to my problem: I have a data frame that I get from a csv: summarystats<-as.data.frame(read.csv(file=f_summary)); where I have the columns Dataset, Class, Type, Category,.. Problem1: I want to find a subset of this frame, based on values in
2011 Mar 06
4
sorting & subsetting a data.frame
Dear all This may be obvious, but I cannot get it working. I'm trying to subset & sort a data frame in one go. x <- iris x$Species1 <- as.character(x$Species) ##subsetting alone works fine with(x, x[Sepal.Length==6.7,]) ##sorting alone works fine with(x, x[order(Sepal.Length, rev(sort(Species1))),]) ##gets subsetted, but not sorted as expected with(x, x[(Sepal.Length==6.7) &
2010 May 30
3
subsetting
Hi, I have a data-frame, r (column names below), that needs subsetting: date, time, strain, gene, deltact When I try to subset r by applying selection criteria on two columns I get an empty data frame. For example I would like to extract all rows that have time == 0h and strain == ROC. So, t <- subset(r, (r$time == "0h" && r$strain == "ROC"), select= c(time,
2007 Jul 12
1
[[.data frame and row names
Hi, I'm wondering why indexing a data frame by row name doesn't work with [[. It works with [: > sw <- swiss[1:5,1:2] > sw["Moutier", "Agriculture"] [1] 36.5 but not with [[: > sw[["Moutier", "Agriculture"]] Error in .subset2(.subset2(x, ..2), ..1) : subscript out of bounds The problem is really with the row name (and not
2024 Mar 24
1
an issue about subsetting a vector
To the R-Help list, I would like to have a clarification about an issue that I observe when subsetting a vector. This is R version 4.3.3 on Windows 10. -- Example with a vector: > a <- 1:5 > a [1] 1 2 3 4 5 So we have, with a negative index: > a[-3] [1] 1 2 4 5 But when the index is integer(0), we have this: > a[integer(0)] integer(0) > a[-integer(0)] integer(0) When
2024 Mar 24
1
an issue about subsetting a vector
As with a lot of things in R, the behaviour is counterintuitive but (arguably) logical. The key (maybe) is that `a[-x]` does not mean "take all of the elements of a except those indicated by `x`, but rather, "negate x, then take all but the negative elements". In other words, -integer(0) is integer(0) (we multiply *each of the elements of integer(0)* by -1, but
2009 Dec 12
1
code for [[.data.frame
Hello. I'm currently trying to wrap up data frames into OCaml via OCaml-R, and I'm having trouble with data frame subsetting: > # x#column 1;; > Erreur dans (function(x, i, exact) if (is.matrix(i)) as.matrix(x)[[i]] else .subset2(x, : > l'?l?ment 1 est vide ; > la partie de la liste d'arguments de 'is.matrix' en cours d'?valuation ?tait : > (i)
2020 Jun 17
2
subset data.frame at C level
Hi, Hope you are well. I was wondering if there is a function at C level that is equivalent to mtcars$carb or .subset2(mtcars, "carb"). If I have the index of the column then the answer would be VECTOR_ELT(df, asInteger(idx)) but I was wondering if there is a way to do it directly from the name of the column without having to loop over columns names to find the index? Thank you Best
2019 Jun 24
2
setting up a new ADS infrastructure
On Sun, Jun 23, 2019 at 03:34:08PM +0200, Stefan Froehlich via samba wrote: > No need to be sorry - most likely I'll the whole setup from scratch. Did so (I am following a script by now, so it does not take too long), but I feel more and more lost - there must be always something different I do wrong: Now I configured DNS the other way round, pointing every host to the DC and using
2007 Oct 14
1
bug (?) in [.data.frame with matrix-like indexing
Consider in R-2.6.0 (also R-patched from yesterday): iris[1, c(TRUE, FALSE, FALSE, FALSE, FALSE)] ## Error in .subset2(xx, j) : recursive indexing failed at level 2 iris[1, c(FALSE, FALSE, FALSE, FALSE, TRUE)] ## Error in .subset2(xx, j) : attempt to select less than one element i.e. matrix-like indexing on data.frames, one logically-indexed dimension with only one value TRUE in it. It is
2011 Feb 24
1
Creating objects (data.frames) with names stored in character vector
Hello, I'm fairly new to R. I'm a chemist, not a programmer so please bear with me. I have a large data.frame that I want to break down (subset) into smaller data.frames for analysis. I would like to give the data.frames descriptive names which I have stored in a character vector. My original thought was that I want the subsets to show up as individual objects, but haveing them stored
2018 Apr 18
3
Problem with regression line
Hello, I am trying to graph a regression line using the followings: Age <- c(39, 47, 45, 47, 65, 46, 67, 42, 67, 56, 64, 56, 59, 34, 42, 48, 45, 17, 20, 19, 36, 50, 39, 21, 44, 53, 63, 29, 25, 69) BloodPressure <- c(144, 220, 138, 145, 162, 142, 170, 124, 158, 154, 162, 150, 140, 110, 128, 130, 135, 114, 116, 124, 136, 142, 120, 120, 160, 158, 144, 130, 125, 175) SimpleLinearReg1=lm(Age ~
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,
2011 Aug 31
3
subsetting by rows
Dear all, I would like to know how to subset a data.frame by rows. Example: Probesets 34884 34888 34892 1 100009676_at A A A 2 10001_at P P P 3 10002_at A A A 4 10003_at A A
2018 Apr 18
0
Problem with regression line
Hi, Anne, assign Age and Bloodpressure in the correct order to the axes in your call to plot as in: plot(y = Age, x = BloodPressure) abline(SimpleLinearReg1) Hth -- Gerrit --------------------------------------------------------------------- Dr. Gerrit Eichner Mathematical Institute, Room 212 gerrit.eichner at math.uni-giessen.de Justus-Liebig-University Giessen Tel:
2010 Nov 04
5
Logical vectors
Hi folks, Pls help me to understand follow; An Introduction to R 2.4 Logical vectors http://cran.r-project.org/doc/manuals/R-intro.html#R-and-statistics 1) > x [1] 1 2 3 4 5 > temp <- x != 1 > temp [1] FALSE TRUE TRUE TRUE TRUE > 2) > x [1] 1 2 3 4 5 > temp <- x > 1 > temp [1] FALSE TRUE TRUE TRUE TRUE Why NOT > temp [1] TRUE FALSE FALSE FALSE
2010 Nov 04
5
Logical vectors
Hi folks, Pls help me to understand follow; An Introduction to R 2.4 Logical vectors http://cran.r-project.org/doc/manuals/R-intro.html#R-and-statistics 1) > x [1] 1 2 3 4 5 > temp <- x != 1 > temp [1] FALSE TRUE TRUE TRUE TRUE > 2) > x [1] 1 2 3 4 5 > temp <- x > 1 > temp [1] FALSE TRUE TRUE TRUE TRUE Why NOT > temp [1] TRUE FALSE FALSE FALSE
2018 Aug 24
5
True length - length(unclass(x)) - without having to call unclass()?
Is there a low-level function that returns the length of an object 'x' - the length that for instance .subset(x) and .subset2(x) see? An obvious candidate would be to use: .length <- function(x) length(unclass(x)) However, I'm concerned that calling unclass(x) may trigger an expensive copy internally in some cases. Is that concern unfounded? Thxs, Henrik
2017 Oct 25
0
Problem Subsetting Rows that Have NA's
> On Oct 25, 2017, at 6:57 AM, BooBoo <booboo at gforcecable.com> wrote: > > On 10/25/2017 4:38 AM, Ista Zahn wrote: >> On Tue, Oct 24, 2017 at 3:05 PM, BooBoo <booboo at gforcecable.com> wrote: >>> This has every appearance of being a bug. If it is not a bug, can someone >>> tell me what I am asking for when I ask for "x[x[,2]==0,]". Thanks.
2012 Apr 21
2
using "factor" to eliminate unused levels without dropping other variables
Hello, I have been banging my head against the wall trying to figure out this seemingly simple problem with no success. I'm hoping that one or some of you can help. Here is the code I am trying to use: #importing data data.file <-read.csv("/file/location", header=TRUE, sep = ",") #selecting a subset of data based on variable "Sample" data.subset1 <-