[R] How to calculate values with percent sign imported from Excel?

David Winsemius dwinsemius at comcast.net
Thu Jun 21 03:53:38 CEST 2012


Dear Conventional Wisdom;

You do realize you only have two distinct values in that factor  
variable, right?

dat <- structure( c(78L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L)....

-- David.

On Jun 20, 2012, at 9:26 PM, C W wrote:

> Hi R list,
> I imported values from Excel, there is a column with numbers like  
> 45%, 65%,
> 12%.
>
> I want to find its mean.  What should I use?
>
> strisplit()
> split()
> parse()
>
> Data from dput(),
>
> structure(c(78L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L), .Label = c("",
>
> "-0.15%", "-0.34%", "-1.3%", "-10.77%", "-100.00%", "-11.45%",
>
> "-12.53%", "-13.06%", "-15.36%", "-15.82%", "-16.96%", "-18.71%",
>
> "-2.02%", "-2.94%", "-21.23%", "-25.00%", "-26.20%", "-29.79%",
>
> "-3.16%", "-3.67%", "-30.52%", "-33.44%", "-37.48%", "-37.89%",
>
> "-39.42%", "-45.88%", "-5.09%", "-51.64%", "-61.58%", "-62.87%",
>
> "-63.51%", "-7.00%", "-7.90%", "-8.33%", "-8.58%", "-8.88%",
>
> "-91.10%", "-94.08%", "-96.01%", "0.98%", "10.00%", "10.04%",
>
> "10.64%", "11.11%", "114.32%", "12.09%", "12.68%", "13.77%",
>
> "14.10%", "15.51%", "16.25%", "16.93%", "16.94%", "18.57%", "18.88%",
>
> "2.46%", "2.55%", "2.79%", "2.93%", "20.00%", "22.67%", "24.50%",
>
> "25.76%", "28.18%", "3.26%", "3.80%", "3.83%", "36.05%", "37.22%",
>
> "40.63%", "5.53%", "5.70%", "6.19%", "6.62%", "6.72%", "63.33%",
>
> "7.14%", "7.21%", "7.39%", "9.15%", "9.99%", "95.00%"), class =  
> "factor")
>
> Thanks,
>
> Mike
>
> 	[[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

David Winsemius, MD
West Hartford, CT



More information about the R-help mailing list