I am doing my r hw for class and for some reason the p value showing up in the console is different than what is in my knitted document

I am data science student and I am running into an issue while doing my hw and even my professor can’t figure it out.

When I use this code: associate(Size_of_Party~Smoker,data = EX2.TIPS, seed=9750), I get the following result.

enter image description here.

As you can see from above, the p value of ANOVA is between 0.017 and 0.049 which means the test is conclusive.

However, when I knit the document, I get different results for the p value range for the anova test.

enter image description here

The p value in my knitted document is showing the p value to be between 0.028 and 0.066 for the ANOVA test which makes sense why it is inconclusive.

Does anyone know why this is happening?

I tried to download the latest R studio version, tried to re-run everything and the same thing keeps happening.

  • 1

    just curious: if you add set.seed(123) in the same code chunk and knit again, will that solve the problem?

    – 




  • Knitted documents sometimes cache their results to save time when re-knitting, and this can sometimes lead to issues where data isn’t updated when it should. Try disabling cache by adding r opts_chunk$set(cache=TRUE) in the first chunk, and/or try restarting your R environment.

    – 

  • The first image doesn’t show any pvalue. More generally, you should post complete code so we can evaluate it ourselves; we don’t have “associate” or “EX2.TIPS”.

    – 

Leave a Comment