Repeated Measures Anova in r using mean grain sizes











up vote
0
down vote

favorite












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







New contributor




user10682953 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.




















  • Welcome So. Please add reproducible example or link to your data in a repository.
    – paoloeusebi
    2 days ago















up vote
0
down vote

favorite












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







New contributor




user10682953 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.




















  • Welcome So. Please add reproducible example or link to your data in a repository.
    – paoloeusebi
    2 days ago













up vote
0
down vote

favorite









up vote
0
down vote

favorite











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







New contributor




user10682953 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











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







New contributor




user10682953 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











share|improve this question







New contributor




user10682953 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









share|improve this question




share|improve this question






New contributor




user10682953 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









asked Nov 21 at 0:21









user10682953

1




1




New contributor




user10682953 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





New contributor





user10682953 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






user10682953 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.












  • Welcome So. Please add reproducible example or link to your data in a repository.
    – paoloeusebi
    2 days ago


















  • Welcome So. Please add reproducible example or link to your data in a repository.
    – paoloeusebi
    2 days ago
















Welcome So. Please add reproducible example or link to your data in a repository.
– paoloeusebi
2 days ago




Welcome So. Please add reproducible example or link to your data in a repository.
– paoloeusebi
2 days ago

















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',
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
});


}
});






user10682953 is a new contributor. Be nice, and check out our Code of Conduct.










 

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






























active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes








user10682953 is a new contributor. Be nice, and check out our Code of Conduct.










 

draft saved


draft discarded


















user10682953 is a new contributor. Be nice, and check out our Code of Conduct.













user10682953 is a new contributor. Be nice, and check out our Code of Conduct.












user10682953 is a new contributor. Be nice, and check out our Code of Conduct.















 


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







Popular posts from this blog

Berounka

Sphinx de Gizeh

Different font size/position of beamer's navigation symbols template's content depending on regular/plain...