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

2012-06-21 Thread Peter Ehlers
On 2012-06-21 06:19, David Winsemius wrote: [...] What you should have done was convert the Excel column to numeric from percentage using the "Format/Cell" menu and then import. This is excellent advice. It has been my experience that _very_ few Excel addicts are aware that columns in thei

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

2012-06-21 Thread David Winsemius
On Jun 20, 2012, at 10:34 PM, C W wrote: I am a noob. I am familiar with factors, but not familiar with how that relates to "two distinct values". How were you able to tell? Please point me out. Mike The first part of a factor's structure is a vector of integers, the part I copied. The

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

2012-06-20 Thread C W
Hi Michael, Thanks a lot, your solution is exactly what I needed! -M On Wed, Jun 20, 2012 at 9:44 PM, R. Michael Weylandt < michael.weyla...@gmail.com> wrote: > Something like: > > X <- as.character(data.name) > X <- as.double(gsub("%","", X))/100 > > mean(X) > quantile(X) > > etc. > > Unteste

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

2012-06-20 Thread C W
I am a noob. I am familiar with factors, but not familiar with how that relates to "two distinct values". How were you able to tell? Please point me out. Mike On Wed, Jun 20, 2012 at 9:53 PM, David Winsemius wrote: > Dear Conventional Wisdom; > > You do realize you only have two distinct values

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

2012-06-20 Thread David Winsemius
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 num

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

2012-06-20 Thread R. Michael Weylandt
Something like: X <- as.character(data.name) X <- as.double(gsub("%","", X))/100 mean(X) quantile(X) etc. Untested [I'm not at my computer so the args for gsub() might be out of order] but one possible solution pattern. Michael On Jun 20, 2012, at 8:26 PM, C W wrote: > Hi R list, > I imp

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

2012-06-20 Thread C W
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%", "-