Skip to content
Prev 336120 / 398513 Next

aggregate()?

Probably, you are referring to:
d <- as.data.frame(cbind(Stock, Soil, Nitrogen, Respiration))###
with(d,aggregate(cbind(Nitrogenr=Nitrogen,Respirationr=Respiration),by=list(Soilr=Soil,Stockr=Stock),FUN=mean))


I used:
d <- data.frame(Stock, Soil, Nitrogen, Respiration)
with(d,aggregate(cbind(Nitrogenr=Nitrogen,Respirationr=Respiration),by=list(Soilr=Soil,Stockr=Stock),FUN=mean))


A.K.
On Sunday, February 2, 2014 2:56 PM, arun <smartpink111 at yahoo.com> wrote:
?
I understand that 'result' is different from my output. It could be a typo or so, which I don't know.? Also, I am not not sure about whether it is about the order or something else you are referring to.
merge(r1, r2, all = TRUE)#Rui's output

???? Soil Stock Respiration Nitrogen
1?? Blank???? A?????? 112.5?????? NA
2?? Blank???? B?????? 110.0?????? NA
3??? Clay???? A?????? 138.0?????? 20
4??? Clay???? B?????? 135.0?????? 20
5 Control???? A?????? 125.0??????? 0
6 Control???? B?????? 123.0??????? 0


with(d,aggregate(cbind(Nitrogenr=Nitrogen,Respirationr=Respiration),by=list(Soilr=Soil,Stockr=Stock),FUN=mean))
??? Soilr Stockr Nitrogenr Respirationr
1?? Blank????? A??????? NA??????? 112.5
2??? Clay????? A??????? 20??????? 138.0
3 Control????? A???????? 0??????? 125.0
4?? Blank????? B??????? NA??????? 110.0
5??? Clay????? B??????? 20??????? 135.0
6 Control????? B???????? 0??????? 123.0


OP's result
?result
? Stockr?? Soilr Nitrogenr Respirationr
1????? A?? Blank??????? NA????????? 111
2????? A Control???????? 0????????? 125
3????? A??? Clay??????? 20????????? 138
4????? B?? Blank??????? NA????????? 110
5????? B Control???????? 0????????? 123
6????? B??? Clay??????? 20????????? 135
A.K.
On Sunday, February 2, 2014 1:52 PM, David Winsemius <dwinsemius at comcast.net> wrote:

        
On Feb 2, 2014, at 8:43 AM, arun wrote:

            
Did you compare your output to the input?
Message-ID: <1391371219.98936.YahooMailNeo@web142605.mail.bf1.yahoo.com>
In-Reply-To: <1391371003.52971.YahooMailNeo@web142602.mail.bf1.yahoo.com>