Quantcast
Channel: Active questions tagged r - Stack Overflow
Viewing all articles
Browse latest Browse all 205301

How to prevent R from rounding in frequency function?

$
0
0

I used the freq function of frequency package to get frequency percent on my dataset$MoriskyAdherence, then R gives me percent values with rounding. I need more decimal places.

MoriskyAdherence=dataset$MoriskyAdherence
freq(MoriskyAdherence)

The result is:

the result

The Percent values are 35.5, 41.3,23.8. The sum of them is 100.1. The exact amounts should be 35.5, 41.25, 23.75.

What should I do? I used sprintf, as.data.frame,formatC, and some other function to deal with it.But...


Viewing all articles
Browse latest Browse all 205301

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>