Reputation: 17
I am new to R. I am trying to calculate the mean and standard deviation of some data and put the final results in a table without decimals. I used the following formula, but I can't get red of the decimals. May be I need to integrate "round" within the "mean" but I don't know how? I would appreciate any help.
Mean<-tapply(NKurdish$VOT, NKurdish$Stop, mean)
SD<-tapply(NKurdish$VOT, NKurdish$Stop, sd)
round(Mean, digits = 0)
round(SD, digits = 0)
rbind(Mean,SD)
this is what I get
Mean -116.80000 -130.11667 -116.53333 83.70000 55.06667 66.28333
SD 37.40108 33.26885 28.44588 18.38044 12.21539 17.53166
Upvotes: 0
Views: 530
Reputation: 513
a <- c(12.11111,12.88888)
as.integer(a) # you probably don't want this
round(a,0) # you probably do want this
# if you want to redefine as integers see...
a2 <- as.integer(round(a,0))
class(a)
class(a2)
Upvotes: 1