Displaying 2 results from an estimated 2 matches for "avgdensity".
2012 Apr 05
2
count() function
...=count function in
Excel, but I can't find anything. I simply want to count the data for a
given category.
I've been using the ddply() function in the plyr package to summarize
means and st dev of my data, with this code:
ddply(NZ_Conifers,.(ElevCat, DataSource, SizeClass), summarise,
avgDensity=mean(Density), sdDensity=sd(Density), n=sum(Density))
and that gives me results that look like this:
ElevCat DataSource SizeClass avgDensity sdDensity n
1 Elev1 FIA Class1 38.67768 46.6673478 734.87598
2 Elev1 FIA Class2 27.34096 23.3232470 8...
2012 Mar 25
2
avoiding for loops
I have data that looks like this:
> df1
group id
1 red A
2 red B
3 red C
4 blue D
5 blue E
6 blue F
I want a list of the groups containing vectors with the ids. I am
avoiding subset(), as it is
only recommended for interactive use. Here's what I have so far:
df1 <- data.frame(group=c("red", "red", "red", "blue",