Thank you so much, Peter and Andrija :)
On Thu, Mar 29, 2012 at 1:44 PM, peter dalgaard wrote:
> %in% is your friend
> mysub <- subset(df, type %in% type_list, select=c(name,type))
> or
> mysub <- df[df$type %in% type_list, c("name","type")]
> The latter is slightly safer if you can't be sure tha
Hi. You can try this:
df[type%in%type_list, ]
You can also use sqldf package and subset data frames usign sql statements:
library(sqldf)
df <- data.frame(x1=1:10, type=10:1)
type_list <- data.frame(index=seq(1,10,by=2))
sqldf("select df.*
from df
where df.type in (select * from ty
On Mar 29, 2012, at 07:25 , reeyarn wrote:
> Hi,
>
> If my data frame "df" has a index "type", I want to get a subset such
> that the type belongs to a "type_list";
> using sql, I want
> SELECT name, type FROM df
>WHERE type in type_list;
>
> Now in R I have to write a loop like
> mysubse
Hi,
If my data frame "df" has a index "type", I want to get a subset such
that the type belongs to a "type_list";
using sql, I want
SELECT name, type FROM df
WHERE type in type_list;
Now in R I have to write a loop like
mysubset<- df [ df$type == type_list[1], ]
for (type1 in type_list[
ystem file
>
Robert Farley
LACMTA
-Original Message-
From: jim holtman [mailto:jholt...@gmail.com]
Sent: Wednesday, 14 March, 2012 20:36
To: Farley, Robert
Cc: R-help@r-project.org
Subject: Re: [R] subset problem
Supply an 'str' of your dataframe so we can see what its
Supply an 'str' of your dataframe so we can see what its structure is.
Do you have leading/trailing blanks in your ROUTE values. Print
them out and see what their number of characters (nchar) are. Are
they factors? You have not supplied enough information like a small
subset. I bet when you c
Thank you.
I put table(factor(x.sub$RES_ID)) and works.
--
View this message in context:
http://r.789695.n4.nabble.com/Subset-problem-tp4452837p4452954.html
Sent from the R help mailing list archive at Nabble.com.
__
R-help@r-project.org mailing
Hi
>
> Good Morning
>
> I have a small question regarding the function subset.
> I am copying data from one table but I just want to collect data from a
> user.
> When do I take the view, presents the results I want.
>
> The problem arises when can I make the tab. for RES_ID, introduces me
Great, this worked for me, exactly how I needed it.
Thanks for all the replies!
Peter Dalgaard wrote:
>
> Ine wrote:
>> Hi all,
>> I have got a seemingly simple problem (I am an R starter) with subsetting
>> my
>> data set, but cannot figure out the solution: I want to subset a data set
>> from
Hi,
does this help?
http://www.nabble.com/factor-question-to18638814.html#a18638814
HTH,
Stephan
Ine schrieb:
Hi all,
I have got a seemingly simple problem (I am an R starter) with subsetting my
data set, but cannot figure out the solution: I want to subset a data set
from six to two levels,
Ine wrote:
Hi all,
I have got a seemingly simple problem (I am an R starter) with subsetting my
data set, but cannot figure out the solution: I want to subset a data set
from six to two levels, so that all analyses are done only with these two
remaining levels.
I tried
TOTAL<-read.delim('total.c
On Thu, Feb 05, 2009 at 01:01:59PM -0800, Ine wrote:
>
> Hi all,
> I have got a seemingly simple problem (I am an R starter) with subsetting my
> data set, but cannot figure out the solution: I want to subset a data set
> from six to two levels, so that all analyses are done only with these two
>
12 matches
Mail list logo