n
grepl(p1,v1) & grepl(p2,v2)
to figure which entries in the table have v1 matching p1 and v2 matching p2.
Or, you could use
intersect(grep(p1,v1), grep(p2,v2))
if you want to stick with integer indices.
Bill Dunlap
Spotfire, TIBCO Software
wdunlap tibco.com
> -Original Message-
&g
es in the table have v1 matching p1 and v2 matching p2.
Or, you could use
intersect(grep(p1,v1), grep(p2,v2))
if you want to stick with integer indices.
Bill Dunlap
Spotfire, TIBCO Software
wdunlap tibco.com
> -Original Message-
> From: r-help-boun...@r-project.org
> [mail
#x27;year')]" , sep="")
[1] "dt2 <- dt[grep('^1.E$', fund) & grep('^1.$', func) & grep('^...$',
obj), sum(amount), by=c('code', 'year')]"
Bill Dunlap
Spotfire, TIBCO Software
wdunlap tibco.com
> -Original M
: 1002 2012 211499
aggregate(amount~code+year,data=df,sum)
# code year amount
#1 1001 2011 185482
#2 1002 2011 238098
#3 1001 2012 189367
#4 1002 2012 211499
In the df, you provided, there is only value of obj.
levels(df$obj)
#[1] "100"
A.K.
- Original Message -
From: "Bu
I have a fairly large data set with six variables set up like the following
dummy:
# Create fake data
df <- data.frame(code = c(rep(1001, 8), rep(1002, 8)),
year = rep(c(rep(2011, 4), rep(2012, 4)), 2),
fund = rep(c("10E", "10E", "10E", "27E"), 4),
5 matches
Mail list logo