Hi,
You could try this:
dat2<- read.table(text='
case pin some_data
"A" "1" "data"
"A" "2" "data"
"A" "1" "data"
"A" "2" "data"
"B" "1" "data"
"B" "2" "data"
',sep="",header=TRUE,stringsAsFactors=FALSE)
dat2[!duplicated(dat2[,1:2]),]
# case pin some_data
#1 A 1 data
Thanks Arun,
Jorge,s idea worked... I can't believe I lost so much time with this...
Â
mike
>
> From:arun
>To: Mihai Nica
>Cc: R help
>Sent: Monday, April 22, 2013 4:57 PM
>Subject:Re: [R] subset dataframe
>
>
>HI,
>Could you provide an example dataset?
>
6304
# $ X2000: int 24950 15292 25260
A.K.
- Original Message -
From: arun
To: Mihai Nica
Cc: R help
Sent: Monday, April 22, 2013 5:57 PM
Subject: Re: [R] subset dataframe
HI,
Could you provide an example dataset?
set.seed(15)
agoa<- data.frame(X.1=rep(c("AGOA","
HI,
Could you provide an example dataset?
set.seed(15)
agoa<- data.frame(X.1=rep(c("AGOA","GSP","CST"),3),X1996=
sample(1:2,9,replace=TRUE),X2000=sample(40:3,9,replace=TRUE))
str(agoa)
#'data.frame': 9 obs. of 3 variables:
# $ X.1 : Factor w/ 3 levels "AGOA","CST","GSP": 1 3 2 1 3 2
Mike,
You need
subset(agoa, agoa$X.1 == "AGOA ")
instead of
subset(agoa, agoa$X.1 == "AGOA")
(note the space after the last A in "AGOA".
HTH,
Jorge.-
On Tue, Apr 23, 2013 at 7:14 AM, Mihai Nica wrote:
> I can't understand what is happening. This is the code and results:
>
> > agoa <- read
Dear Cecilia,
I have followed the replies you got and I found that, perhaps, what you are
experiencing has something to do with the decimal symbol in your data.
Consider the following:
# Reading the data as you sent it to the list
x <- read.table(textConnection("caedois b1 b2
So now is the time to back up to the beginning and demonstrate how you
created the coeficientes object. Ideally you would also provide the
results of:
dput(coeficientes)
or
str(coeficientes)
Subset will only work with dataframes, so if coeficientes is not a
dataframe, then you will need
It doesn't work. b1 was substituted by NA's with this
message:
Warning message:
NAs introduced by coercion
I will see in the webpage that you mentioned.
Thanks,
Cecília
Em Mon, 1 Jun 2009 13:23:12 -0400
David Winsemius escreveu:
On Jun 1, 2009, at 1:01 PM, Cecilia Carmo wrote:
Hi R-help
On Jun 1, 2009, at 1:01 PM, Cecilia Carmo wrote:
Hi R-helpers!
I have the following object:
head(coeficientes)
caedois b1 b2 b3
1 10,033120395 -20,29478338 -0,274638864
2 2 -0,040629634 74,54239889 -0,069958424
3 5 -0,001116816 35
Here is one way of doing it:
> moreThan <- ave(choose$code, choose$code, FUN=length)
> moreThan
[1] 2 2 4 4 4 4 2 2 6 6 6 6 6 6
> choose[moreThan > 2,]
firm year code
3 2 2000 11
4 2 2001 11
5 2 2002 11
6 2 2003 11
9 4 2001 13
104 2002 13
114 2003 13
1
ch appreciate your help, thanks again.
Zack
CC: r-help@r-project.org
From: ba...@exeter.ac.uk
To: zack_hol...@hotmail.com
Subject: Re: [R] subset dataframe by rows using character vector?
Date: Tue, 14 Apr 2009 15:56:45 +0100
Is this what you want?
plotNam
Is this what you want?
plotNames <- c("plot1", "plot2", "plot3") # plot is probably best
left as the name of the base function
full.data[full.data$PLOTID %in% plotNames, ] # note the comma
HTH,
baptiste
On 14 Apr 2009, at 15:20, zack holden wrote:
Dear List,
I'm stuck on what seems
12 matches
Mail list logo