Good day everyone, need help to confirm that is there a bug during HTML rendering !?
I got a simple data frame from an operation,
then I remove the second column that has no name ""
then operate mutate and arrange
All were perfectly operated in RMarkdown but when I knit it to HTML, there is an error saying "Confidence" not found. Confidence is a variable and it is found when I operated otherwise the mutate operation would have failed. I think it is an error or bug,. I have tried many different ways but I just cannot get HTML rendereed, found that it could be caused by bug somewhere.
From what I can see in your screenshot, there is no bug. You simply have forgot to assign the changes to a variable, dplyrdoesn't perform in-place modifications, it returns a new data frame instead, if you want changes to persist, you have to explicitly assign them to a variable with the assign operator (<-).
No, I didn't forget, I have been using R for 7 years. And dplyr does perform in-place modifications, plus, if it doesn't the RMarkdown result chunk would be fail to give the modified data frame, but it succeeded.
For sure, if I want change to persist the changes I have to assign it to an object or replace the original object.
What strange is that everything was successfully run in RMarkdown, but interestingly failed to render to HTML.
My bad, in my defense, debugging from a screenshot is far from ideal, sorry if I have offended your experienced programmer sensitivity. Any chance you can produce a reproducible example?
About this, I think we are not talking about the same thing, as you said as well, explicit assignment is required, dplyr functions do not perform in-place modification on their own.
Sorry I wasn't clear. I meant "dplyr does perform in-place modifications under the context of RMarkdown for temporary display only (see the RMarkdown picture of the result chunk under the code chunk), if permanent modifications are to be made, one should use the assign operator. "
That's why I said the two sentences and also why I said "dplyr does perform in-place modifications" because I am showing my example in RMarkdown with the output chunk under the code chunk. Anyway, it is not the point, and either the way whether I have used the assignment operator or not, it will not affect the HTML rendering and the HTML file should still be rendered. It is the strange part.
Thank you for your information. Sorry, I do not have an reproducible example..