Repeated Measures Anova in r using mean grain sizes

Multi tool use
Multi tool use












0














I am trying to run a repeated measures anova using r studio. I have in my possession mean sand grain sizes that were collected over a 12 year period from nine sites. Samples were collected from 4 sections of the beach: Foreshore, Backshore, MidBeach, Dune and saved in .csv format. I am testing to see if there is variation between mean grain sizes over time according to the site and shore position. Ex: I want to run a repeated measures anova of the mean grain sizes for "Foreshore" between all nine sites. I am not too sure if I am actually coding this properly and would like some help if possible.Sand Data p



Here is my line of code without specifying a section of the beach



```{r}
Years <- c(1,2,3,4,5,6,7,8,9,10,11,12)
YearFactor <- as.factor(Years)
YearFrame <- data.frame(YearFactor)
YearBind <- cbind(SandData$X2001, SandData$X2002, SandData$X2004, SandData$X2006, SandData$X2007, SandData$X2010, SandData$X2012, SandData$X2014, SandData$X2015, SandData$X2016, SandData$X2017, SandData$X2018)
library(car)
SandDataModel <- lm(YearBind ~ 1)
summary(SandDataModel)
```


This is code I used to run the same analysis but with only Foreshore mean grain values being tested.



```{r}
SandData_Foreshore <- subset(SandData, ShorePosition == "Foreshore", select= c("Site", "ShorePosition", "X2001", "X2002", "X2004", "X2006", "X2007", "X2010", "X2012", "X2014", "X2015", "X2016", "X2017", "X2018"))
SandData_Foreshore
YearBind_Foreshore <- cbind(SandData_Foreshore$X2001, SandData_Foreshore$X2002, SandData_Foreshore$X2004, SandData_Foreshore$X2006, SandData_Foreshore$X2007, SandData_Foreshore$X2010, SandData_Foreshore$X2012, SandData_Foreshore$X2014, SandData_Foreshore$X2015, SandData_Foreshore$X2016, SandData_Foreshore$X2017, SandData_Foreshore$X2018)
SandData_Foreshore <- lm(YearBind_Foreshore ~ 1)
analysis_Foreshore <- Anova(SandData_Foreshore, idata = YearFrame, idesign = ~YearFactor)
summary(analysis_Foreshore)
```


I am getting the following error message when I run the chunk above: error in eigen(qr.coef(SSPE.qr, x$SSPH), symmetric = FALSE) : infinite or missing values in 'x'



I know that the issue is related to the missing values in the data set. What would you all recommend to alleviate this error?



Essentially I need to know the following three things.
1.) Does my code look correct for this type of analysis?
2.) If my code is not correct, what steps do I need to take so my analysis is correct?
3.) How to deal with that error in the second chunk of code?



Thanks in advance










share|improve this question






















  • Welcome So. Please add reproducible example or link to your data in a repository.
    – paoloeusebi
    Nov 21 '18 at 8:17
















0














I am trying to run a repeated measures anova using r studio. I have in my possession mean sand grain sizes that were collected over a 12 year period from nine sites. Samples were collected from 4 sections of the beach: Foreshore, Backshore, MidBeach, Dune and saved in .csv format. I am testing to see if there is variation between mean grain sizes over time according to the site and shore position. Ex: I want to run a repeated measures anova of the mean grain sizes for "Foreshore" between all nine sites. I am not too sure if I am actually coding this properly and would like some help if possible.Sand Data p



Here is my line of code without specifying a section of the beach



```{r}
Years <- c(1,2,3,4,5,6,7,8,9,10,11,12)
YearFactor <- as.factor(Years)
YearFrame <- data.frame(YearFactor)
YearBind <- cbind(SandData$X2001, SandData$X2002, SandData$X2004, SandData$X2006, SandData$X2007, SandData$X2010, SandData$X2012, SandData$X2014, SandData$X2015, SandData$X2016, SandData$X2017, SandData$X2018)
library(car)
SandDataModel <- lm(YearBind ~ 1)
summary(SandDataModel)
```


This is code I used to run the same analysis but with only Foreshore mean grain values being tested.



```{r}
SandData_Foreshore <- subset(SandData, ShorePosition == "Foreshore", select= c("Site", "ShorePosition", "X2001", "X2002", "X2004", "X2006", "X2007", "X2010", "X2012", "X2014", "X2015", "X2016", "X2017", "X2018"))
SandData_Foreshore
YearBind_Foreshore <- cbind(SandData_Foreshore$X2001, SandData_Foreshore$X2002, SandData_Foreshore$X2004, SandData_Foreshore$X2006, SandData_Foreshore$X2007, SandData_Foreshore$X2010, SandData_Foreshore$X2012, SandData_Foreshore$X2014, SandData_Foreshore$X2015, SandData_Foreshore$X2016, SandData_Foreshore$X2017, SandData_Foreshore$X2018)
SandData_Foreshore <- lm(YearBind_Foreshore ~ 1)
analysis_Foreshore <- Anova(SandData_Foreshore, idata = YearFrame, idesign = ~YearFactor)
summary(analysis_Foreshore)
```


I am getting the following error message when I run the chunk above: error in eigen(qr.coef(SSPE.qr, x$SSPH), symmetric = FALSE) : infinite or missing values in 'x'



I know that the issue is related to the missing values in the data set. What would you all recommend to alleviate this error?



Essentially I need to know the following three things.
1.) Does my code look correct for this type of analysis?
2.) If my code is not correct, what steps do I need to take so my analysis is correct?
3.) How to deal with that error in the second chunk of code?



Thanks in advance










share|improve this question






















  • Welcome So. Please add reproducible example or link to your data in a repository.
    – paoloeusebi
    Nov 21 '18 at 8:17














0












0








0







I am trying to run a repeated measures anova using r studio. I have in my possession mean sand grain sizes that were collected over a 12 year period from nine sites. Samples were collected from 4 sections of the beach: Foreshore, Backshore, MidBeach, Dune and saved in .csv format. I am testing to see if there is variation between mean grain sizes over time according to the site and shore position. Ex: I want to run a repeated measures anova of the mean grain sizes for "Foreshore" between all nine sites. I am not too sure if I am actually coding this properly and would like some help if possible.Sand Data p



Here is my line of code without specifying a section of the beach



```{r}
Years <- c(1,2,3,4,5,6,7,8,9,10,11,12)
YearFactor <- as.factor(Years)
YearFrame <- data.frame(YearFactor)
YearBind <- cbind(SandData$X2001, SandData$X2002, SandData$X2004, SandData$X2006, SandData$X2007, SandData$X2010, SandData$X2012, SandData$X2014, SandData$X2015, SandData$X2016, SandData$X2017, SandData$X2018)
library(car)
SandDataModel <- lm(YearBind ~ 1)
summary(SandDataModel)
```


This is code I used to run the same analysis but with only Foreshore mean grain values being tested.



```{r}
SandData_Foreshore <- subset(SandData, ShorePosition == "Foreshore", select= c("Site", "ShorePosition", "X2001", "X2002", "X2004", "X2006", "X2007", "X2010", "X2012", "X2014", "X2015", "X2016", "X2017", "X2018"))
SandData_Foreshore
YearBind_Foreshore <- cbind(SandData_Foreshore$X2001, SandData_Foreshore$X2002, SandData_Foreshore$X2004, SandData_Foreshore$X2006, SandData_Foreshore$X2007, SandData_Foreshore$X2010, SandData_Foreshore$X2012, SandData_Foreshore$X2014, SandData_Foreshore$X2015, SandData_Foreshore$X2016, SandData_Foreshore$X2017, SandData_Foreshore$X2018)
SandData_Foreshore <- lm(YearBind_Foreshore ~ 1)
analysis_Foreshore <- Anova(SandData_Foreshore, idata = YearFrame, idesign = ~YearFactor)
summary(analysis_Foreshore)
```


I am getting the following error message when I run the chunk above: error in eigen(qr.coef(SSPE.qr, x$SSPH), symmetric = FALSE) : infinite or missing values in 'x'



I know that the issue is related to the missing values in the data set. What would you all recommend to alleviate this error?



Essentially I need to know the following three things.
1.) Does my code look correct for this type of analysis?
2.) If my code is not correct, what steps do I need to take so my analysis is correct?
3.) How to deal with that error in the second chunk of code?



Thanks in advance










share|improve this question













I am trying to run a repeated measures anova using r studio. I have in my possession mean sand grain sizes that were collected over a 12 year period from nine sites. Samples were collected from 4 sections of the beach: Foreshore, Backshore, MidBeach, Dune and saved in .csv format. I am testing to see if there is variation between mean grain sizes over time according to the site and shore position. Ex: I want to run a repeated measures anova of the mean grain sizes for "Foreshore" between all nine sites. I am not too sure if I am actually coding this properly and would like some help if possible.Sand Data p



Here is my line of code without specifying a section of the beach



```{r}
Years <- c(1,2,3,4,5,6,7,8,9,10,11,12)
YearFactor <- as.factor(Years)
YearFrame <- data.frame(YearFactor)
YearBind <- cbind(SandData$X2001, SandData$X2002, SandData$X2004, SandData$X2006, SandData$X2007, SandData$X2010, SandData$X2012, SandData$X2014, SandData$X2015, SandData$X2016, SandData$X2017, SandData$X2018)
library(car)
SandDataModel <- lm(YearBind ~ 1)
summary(SandDataModel)
```


This is code I used to run the same analysis but with only Foreshore mean grain values being tested.



```{r}
SandData_Foreshore <- subset(SandData, ShorePosition == "Foreshore", select= c("Site", "ShorePosition", "X2001", "X2002", "X2004", "X2006", "X2007", "X2010", "X2012", "X2014", "X2015", "X2016", "X2017", "X2018"))
SandData_Foreshore
YearBind_Foreshore <- cbind(SandData_Foreshore$X2001, SandData_Foreshore$X2002, SandData_Foreshore$X2004, SandData_Foreshore$X2006, SandData_Foreshore$X2007, SandData_Foreshore$X2010, SandData_Foreshore$X2012, SandData_Foreshore$X2014, SandData_Foreshore$X2015, SandData_Foreshore$X2016, SandData_Foreshore$X2017, SandData_Foreshore$X2018)
SandData_Foreshore <- lm(YearBind_Foreshore ~ 1)
analysis_Foreshore <- Anova(SandData_Foreshore, idata = YearFrame, idesign = ~YearFactor)
summary(analysis_Foreshore)
```


I am getting the following error message when I run the chunk above: error in eigen(qr.coef(SSPE.qr, x$SSPH), symmetric = FALSE) : infinite or missing values in 'x'



I know that the issue is related to the missing values in the data set. What would you all recommend to alleviate this error?



Essentially I need to know the following three things.
1.) Does my code look correct for this type of analysis?
2.) If my code is not correct, what steps do I need to take so my analysis is correct?
3.) How to deal with that error in the second chunk of code?



Thanks in advance







r anova manova






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 21 '18 at 0:21









user10682953

1




1












  • Welcome So. Please add reproducible example or link to your data in a repository.
    – paoloeusebi
    Nov 21 '18 at 8:17


















  • Welcome So. Please add reproducible example or link to your data in a repository.
    – paoloeusebi
    Nov 21 '18 at 8:17
















Welcome So. Please add reproducible example or link to your data in a repository.
– paoloeusebi
Nov 21 '18 at 8:17




Welcome So. Please add reproducible example or link to your data in a repository.
– paoloeusebi
Nov 21 '18 at 8:17












0






active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53403581%2frepeated-measures-anova-in-r-using-mean-grain-sizes%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53403581%2frepeated-measures-anova-in-r-using-mean-grain-sizes%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







l9nO6R7z2zs rhz 2Hqn10kAhjxW1uFZUJ
CQ,vFd,e W 3YtDcLcO,Jy Z9Y3rp dk rckc zL dBLjX wftmpiojAp,KiqO

Popular posts from this blog

Costa Masnaga

Fotorealismo

Sidney Franklin