Lots of ways to do this, I use %in% with bracket notation [row, column].
The empty column argument below returns all columns but you could have
conditional logic there as well.
dd[dd$rows %in% test_rows, ]
On Mon, Jun 8, 2015 at 6:44 PM, Bogdan Tanasa wrote:
> Dear all,
>
> would appreciate y
Use is.element(elements,set), or its equivalent, elements %in% set:
df <- data.frame(dd = c(1, 2, 3),
rows = c("A1", "A2", "A3"),
columns = c("B1", "B2", "B3"),
numbers = c(400, 500, 600))
test_rows <-c("A1","A3")
df[ is.element(df$rows, test_rows
t; -Original Message-
> From: r-help-boun...@r-project.org
> [mailto:r-help-boun...@r-project.org] On Behalf Of Sneha Bishnoi
> Sent: Thursday, March 27, 2014 11:06 AM
> To: Sarah Goslee
> Cc: r-help
> Subject: Re: [R] Subsetting a dataframe by dynamic column name
>
> Hi Sara
e
Cc: r-help
Subject: Re: [R] Subsetting a dataframe by dynamic column name
Hi Sarah,
Thanks! Do agree its over complicated.
However looking at the solutions I think I did not state my
problem
completely.
V provides choices for only certain set of columns in Finaldata.
So v2 may not represent al
Hi Sarah,
Thanks! Do agree its over complicated.
However looking at the solutions I think I did not state my problem
completely.
V provides choices for only certain set of columns in Finaldata.
So v2 may not represent all columns of Finaldata.
I want to retain columns not provided as a choice for
There are many ways. You're making it overly complicated
Here, in an actual reproducible example (as you were requested to submit):
V <- data.frame(v1=c(1,0,0), v2=c("Shape", "Length", "Rate"),
stringsAsFactors=FALSE)
Finaldata <- data.frame(Shape = runif(5), Length = runif(5), Rate = runif(5))
Thanks all for your help.
Anjan
On Sun, Oct 24, 2010 at 1:38 PM, Jorge Ivan Velez
wrote:
> Hi Anjan,
>
> Please consider the following example:
>
> > x <- c(2, rep(1, 10))
> > all(x == 1)
> [1] FALSE
> > d <- replicate(10, sample(x, replace = TRUE))
> > d
> [,1] [,2] [,3] [,4] [,5] [,6] [,
Hi Anjan,
Please consider the following example:
> x <- c(2, rep(1, 10))
> all(x == 1)
[1] FALSE
> d <- replicate(10, sample(x, replace = TRUE))
> d
[,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
[1,]111111211 1
[2,]11121
> -Original Message-
> From: r-help-boun...@r-project.org
> [mailto:r-help-boun...@r-project.org] On Behalf Of yjmha69
> Sent: Friday, June 04, 2010 12:28 PM
> To: R-help@r-project.org
> Subject: [R] subsetting a dataframe
>
> Hi there,
> > a<-data.frame(c(1,2,2,5,9,9),c("A","B","C","D",
Try this:
subset(x, eval(parse(text=filter)))
On Wed, Jul 8, 2009 at 4:46 PM, Tracey Frescino wrote:
> Hi,
>
> I am trying to subset a dataset based on a filter defined by a user...
> I prompt the user for input.. resulting in a string logical expression
> ("X1 < 3").
>
> I have tried using su
On 3/4/2008 8:41 AM, John Sorkin wrote:
> windows XP
> R 2.6.0
>
> I am having problems deleting a row from a data frame. I create my dataframe
> by subsetting a larger dataframe:
>
> ShortLavin<-Lavin[Lavin[,"Site"]=="PP" | Lavin[,"Site"]=="CC" |
> Lavin[,"Site"]=="FH",]
I would do that in
try this:
Minus127 <- ShortLavin[!row.names(ShortLavin) %in% "127", ]
I hope it helps.
Best,
Dimitris
Dimitris Rizopoulos
Biostatistical Centre
School of Public Health
Catholic University of Leuven
Address: Kapucijnenvoer 35, Leuven, Belgium
Tel: +32/(0)16/336899
Fax: +32/(0)16/337015
We
On Tue, 4 Mar 2008, John Sorkin wrote:
> windows XP
> R 2.6.0
>
> I am having problems deleting a row from a data frame. I create my dataframe
> by subsetting a larger dataframe:
>
> ShortLavin<-Lavin[Lavin[,"Site"]=="PP" | Lavin[,"Site"]=="CC" |
> Lavin[,"Site"]=="FH",]
>
> I then perform a glm
13 matches
Mail list logo