Re: [R] Calculating the mean in one column with empty cells

2012-10-08 Thread PIKAL Petr
fire, TIBCO Software > wdunlap tibco.com > > > > -Original Message- > > From: r-help-boun...@r-project.org > > [mailto:r-help-boun...@r-project.org] On Behalf Of David Winsemius > > Sent: Saturday, October 06, 2012 9:08 AM > > To: fxen3k > > Cc: r-hel

Re: [R] Calculating the mean in one column with empty cells

2012-10-06 Thread R. Michael Weylandt
On Oct 6, 2012, at 4:54 PM, fxen3k wrote: > I created a Microsoft Excel spreadsheet. As you said, I only have "as > displayed" numbers. I just solved the problem by showing 25 decimal places > in Excel and then exported the data into a CSV-file. > > Is there a better way to solve this? > Do

Re: [R] Calculating the mean in one column with empty cells

2012-10-06 Thread fxen3k
I created a Microsoft Excel spreadsheet. As you said, I only have "as displayed" numbers. I just solved the problem by showing 25 decimal places in Excel and then exported the data into a CSV-file. Is there a better way to solve this? Regards, Felix -- View this message in context: http://r.

Re: [R] Calculating the mean in one column with empty cells

2012-10-06 Thread William Dunlap
David Winsemius > Sent: Saturday, October 06, 2012 9:08 AM > To: fxen3k > Cc: r-help@r-project.org > Subject: Re: [R] Calculating the mean in one column with empty cells > > > On Oct 6, 2012, at 1:11 AM, fxen3k wrote: > > > Hi, > > > > the first comman

Re: [R] Calculating the mean in one column with empty cells

2012-10-06 Thread David Winsemius
On Oct 6, 2012, at 1:11 AM, fxen3k wrote: > Hi, > > the first command was bringing the numbers into R directly: > *> testdata <- c(0.2006160108532920, 0.1321167173880490, 0.0563941428921262, > 0.0264198664609803, 0.0200581303857603, -0.2971754213679500, > -0.2353086361784190, 0.066719553829653

Re: [R] Calculating the mean in one column with empty cells

2012-10-06 Thread John Kane
il.com > Sent: Sat, 6 Oct 2012 01:11:11 -0700 (PDT) > To: r-help@r-project.org > Subject: Re: [R] Calculating the mean in one column with empty cells > > Hi, > > the first command was bringing the numbers into R directly: > *> testdata <- c(0.2006160

Re: [R] Calculating the mean in one column with empty cells

2012-10-06 Thread R. Michael Weylandt
On Sat, Oct 6, 2012 at 9:11 AM, fxen3k wrote: > Hi, > > the first command was bringing the numbers into R directly: > *> testdata <- c(0.2006160108532920, 0.1321167173880490, 0.0563941428921262, > 0.0264198664609803, 0.0200581303857603, -0.2971754213679500, > -0.2353086361784190, 0.066719553829653

Re: [R] Calculating the mean in one column with empty cells

2012-10-06 Thread fxen3k
Hi, the first command was bringing the numbers into R directly: *> testdata <- c(0.2006160108532920, 0.1321167173880490, 0.0563941428921262, 0.0264198664609803, 0.0200581303857603, -0.2971754213679500, -0.2353086361784190, 0.0667195538296534, 0.1755852636926560) > mean(testdata) [1] 0.0161584*

Re: [R] Calculating the mean in one column with empty cells

2012-10-05 Thread PIKAL Petr
Hi > -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- > project.org] On Behalf Of fxen3k > Sent: Friday, October 05, 2012 3:18 PM > To: r-help@r-project.org > Subject: Re: [R] Calculating the mean in one column with empty cells > &

Re: [R] Calculating the mean in one column with empty cells

2012-10-05 Thread William Dunlap
n...@r-project.org] On > Behalf > Of fxen3k > Sent: Friday, October 05, 2012 6:15 AM > To: r-help@r-project.org > Subject: Re: [R] Calculating the mean in one column with empty cells > > I'm sorry! > > Now I tried it again with just 10 numbers (just random numbers) and

Re: [R] Calculating the mean in one column with empty cells

2012-10-05 Thread Sarah Goslee
If the numbers were imported correctly you wouldn't need to do as.numeric(as.character(yourdata)). Please use dput() to provide your data, as in: dput(dataSet2$ac_bhar_60d_4d_after_ann[2:10]) Otherwise it's impossible for us to diagnose your problem or reproduce your error. testdata <- c(0.20061

Re: [R] Calculating the mean in one column with empty cells

2012-10-05 Thread fxen3k
I'm sorry! Now I tried it again with just 10 numbers (just random numbers) and Excel gives a different output than R. Here are the numbers I used: 0,2006160108532920 0,1321167173880490 0,0563941428921262 0,0264198664609803 0,0200581303857603 -0,2971754213679500 -0,2353086361784190 0,06671955382

Re: [R] Calculating the mean in one column with empty cells

2012-10-05 Thread fxen3k
I imported the whole dataset with read.csv2() and it works fine. (2 for German is correct ;) ) I already checked the numbers and I also tried to calculate the mean of a range of numbers where there is no NA given. (as mentioned in my last post above). -- View this message in context: http://r

Re: [R] Calculating the mean in one column with empty cells

2012-10-05 Thread arun
HI, Not sure how your dataset looks like: set.seed(1) dat1<-data.frame(col1=c(sample(1:50,5,replace=TRUE),NA,sample(1:25,3,replace=TRUE),NA,sample(1:25,2,replace=TRUE)),col2=c(NA,NA,rnorm(8,15),NA,NA)) mean(dat1$col1[!is.na(dat1$col1)]) #[1] 20.1  mean(dat1$col1,na.rm=TRUE) #[1] 20.1 But, there i

Re: [R] Calculating the mean in one column with empty cells

2012-10-05 Thread Ken Takagi
fxen3k gmail.com> writes: > > Hi all, > > I recently tried to calculate the mean and the median just for one column. > In this column I have numbers with some empty cells due to missing data. > So how can I calculate the mean just for the filled cells? > I tried: > mean(dataSet2$ac_60d_4d_aft

Re: [R] Calculating the mean in one column with empty cells

2012-10-05 Thread Berend Hasselman
On 05-10-2012, at 11:27, fxen3k wrote: > Hi all, > > I recently tried to calculate the mean and the median just for one column. > In this column I have numbers with some empty cells due to missing data. > So how can I calculate the mean just for the filled cells? > I tried: > mean(dataSet2$ac_

Re: [R] Calculating the mean in one column with empty cells

2012-10-05 Thread PIKAL Petr
Hi see inline > -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- > project.org] On Behalf Of fxen3k > Sent: Friday, October 05, 2012 11:28 AM > To: r-help@r-project.org > Subject: [R] Calculating the mean in one column with empty cells > > Hi all, > > I