aggregate function

Go down

aggregate function

Post by alinemeret on Thu May 26, 2016 5:17 pm

Hi guise
Maybe one of you can help. I need to create a sub data frame by using the aggregate function. The goal is that I would have something like this
http://i86.servimg.com/u/f86/19/45/03/83/bildsc10.png

For me it looks like this....
http://i86.servimg.com/u/f86/19/45/03/83/bildsc11.png

I use this code
MeanLang1 <- aggregate(alldata$Language, by=list(Group=alldata$Group,Language=alldata$LangFac,Condition=alldata$Condition),FUN=mean, na.rm = TRUE)
View(MeanLang1)

Language is binomial (0/1) I guess thats the problem but I just don't know how to solve it Shocked

Any ideas? confused

alinemeret

Posts : 4
Join date : 2016-03-02

View user profile

Back to top Go down

Re: aggregate function

Post by Santiak on Tue May 31, 2016 6:50 pm

I imagine you've gotten the tip from Kristian, and I faced roughly the same problem. I ultimately decided to resort to an editor and manually pre-format the data using that, rather then try and finackle a workaround using code.

So, for example, you calculate the average Proportion (as I imagine it's not meant a binary value?), and input that data manually using a spreadsheet program like OpenOffice Calculate.
Not the most nerdy or satisfying way of going about it, but when it comes to formatting values, R can be a bit like trying to arrange a table while blindfolded, I find. ;S

Alternatively, I see your data is almost fitting(?) as intended, but just with Condition values being numeric rather than factorial, in which case you can rename them:

Rename x to Y
df$value[df$value == "x"] <- "Y"

Santiak
Admin

Posts : 23
Join date : 2016-02-24

View user profile

Back to top Go down

Re: aggregate function

Post by alinemeret on Wed Jun 01, 2016 8:42 am

Thanks a lot! I also ended up doing it the non-nerdy way Smile

Good luck with the upcoming exam!

alinemeret

Posts : 4
Join date : 2016-03-02

View user profile

Back to top Go down

Re: aggregate function

Post by Sponsored content


Sponsored content


Back to top Go down

Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum