aggregate function
2 posters
Cognitive Semiotics :: Tools :: R
Page 1 of 1
aggregate function
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
https://i.servimg.com/u/f86/19/45/03/83/bildsc10.png
For me it looks like this....
https://i.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
Any ideas?
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
https://i.servimg.com/u/f86/19/45/03/83/bildsc10.png
For me it looks like this....
https://i.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
Any ideas?
alinemeret- Posts : 4
Join date : 2016-03-02
Re: aggregate function
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"
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
Re: aggregate function
Thanks a lot! I also ended up doing it the non-nerdy way
Good luck with the upcoming exam!
Good luck with the upcoming exam!
alinemeret- Posts : 4
Join date : 2016-03-02
Cognitive Semiotics :: Tools :: R
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum
|
|