Contradictory output RStudio vs R Interface

I would try restarting RStudio. Actually a complete system reboot might be a good idea.

For us to check things out we will need a reproducible example (reprex)

Preferably with all your data or a sample of it that illustrates the problem. A handy way to supply sample data is to use the dput() function. See ?dput. If you have a very large data set then something like head(dput(myfile), 100) will likely supply enough data for us to work with.