The error: Rstudio is flagging an error where there is none. All code runs and works as you'd expect.
I'm using the Whickham
data set, categorical data on whether smokers lived or not. Most conveniently found in the mosaicData
package.
These are the functions within two lines of the error in both directions, including the blank line and the comment. There are no with()
or attach()
blocks or anything silly like that in play.
require(mosaicData)
table(Whickham$smoker, Whickham$outcome)
with(Whickham, table(outcome, smoker))
xtabs(~ outcome + smoker, data = Whickham)
#### Graphical Methods
ANd here's a screenshot of what I'm seeing.
The xtabs()
function asks for the formula to be entered as you see. The help page says to place them to the right of the tilde, connected by a plus sign.
EDIT: From comments below, I can tell that I am not communicating well. The error I'm speaking of is the one that RStudio is marking on the xtabs()
line. You see the yellow triangular caution symbol there, line 12, and if you hover over the icon, you get the message in the hint box that's also pictured. The code itself works just fine; it's the non-error error that I'm reporting.