[R] help with if statement

2012-11-21 Thread york8866
Hi all, I had a dataset A like: TIME DV 0 0 1 10 520 24 30 36 80 48 60 72 15 I would like to add 24 to those values higher than 24 in the TIME column. I did the following: If (A$TIME=24) { A$TIME - A$TIME+24} It did not work. How should I do it? Thanks, -- View this message

Re: [R] replacing random repeated numbers with a series of sequenced numbers

2012-10-18 Thread york8866
Hi arun, Thanks, I used your code, however, there's error message Error: could not find function count. Thanks, -- View this message in context: http://r.789695.n4.nabble.com/replacing-random-repeated-numbers-with-a-series-of-sequenced-numbers-tp4646559p4646562.html Sent from the R help

Re: [R] replacing random repeated numbers with a series of sequenced numbers

2012-10-18 Thread york8866
Hi Arun, Thanks, it works now. Hi Rui, Your code also works. Thanks, -- View this message in context: http://r.789695.n4.nabble.com/replacing-random-repeated-numbers-with-a-series-of-sequenced-numbers-tp4646559p4646609.html Sent from the R help mailing list archive at Nabble.com.

[R] time extraction and normalization

2012-10-15 Thread york8866
Dear all, I have a series of time variables such as: 04MAY2011:08:19:00 01JUN2011:09:44:00 28JUN2011:08:08:00 25JUL2011:07:44:00 How could I extract the time as a number, so that I can normalize the times by the first time variable? Thanks, -- View this message in context:

Re: [R] time extraction and normalization

2012-10-15 Thread york8866
Thanks, The code gives the numbers in days, how can I adjust the code to directly get the numbers in hours? I tried units but it did not work. Thanks1 -- View this message in context: http://r.789695.n4.nabble.com/time-extraction-and-normalization-tp4646275p4646298.html Sent from the R

[R] extract number from a mixture of character and number

2012-07-16 Thread york8866
Hi, all, I have a column like the following: ID TIME sub_001 0 sub_001 24 sub_002 0 sub_00224 sub_003 0 sub_00324

Re: [R] how to make a histogram with percentage on top of each bar?

2012-06-22 Thread york8866
Thank you all for the help, York -- View this message in context: http://r.789695.n4.nabble.com/how-to-make-a-histogram-with-percentage-on-top-of-each-bar-tp4634131p4634203.html Sent from the R help mailing list archive at Nabble.com. __

[R] how to make a histogram with percentage on top of each bar?

2012-06-21 Thread york8866
I have a dataset like the following: ID DV 1 0.868576818 2 0.337120116 3 0.029233775 4 0.719783525 5 0.976631182 6 0.672941605 7 0.13239462 8 0.99936475 9 0.91540604 10 0.545686514 to get a histogram with y axis as percentage, I

[R] data normalization

2012-06-20 Thread york8866
I have a dataframe such like the following: ID TIMEDV 1 0 0.880146038 1 1 0.88669051 1 3 0.610784702 1 5 0.75604 2 0 0.456263368 2 1 0.369991537 2 3 0.508798346 2 5 0.441037014 3 0

[R] can not read a table

2012-06-20 Thread york8866
I have a table like the following: TABLE NO. 1 ID TIME 13250 13250 . . . . . . TABLE NO. 1 ID TIME 13250 13250 . . . . . . TABLE NO. 1 ID TIME 13250 13250 . . . . . . TABLE NO. 1 ID

Re: [R] data normalization

2012-06-20 Thread york8866
Thanks for the help, it works very well. -- View this message in context: http://r.789695.n4.nabble.com/data-normalization-tp4633939p4633964.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list

Re: [R] can not read a table

2012-06-20 Thread york8866
to re-read fileName - tempfile() writeLines(x, fileName) # now read in the data /* read.table(fileName, header = TRUE)*/ ID TIME 1 13250 2 13250 3 13250 4 13250 5 13250 6 13250 7 13250 8 13250 On Wed, Jun 20, 2012 at 10:08 AM, york8866 lt

Re: [R] can not read a table

2012-06-20 Thread york8866
Thanks, sorry for my post being a little confusing. Jim's code works, I just need to change the last line to y - read.table(file = fileName,header=TRUE) then, I got the dataframe that I needed. thank you all forl your help! -- View this message in context:

Re: [R] Help deleting negative values in a matrix, and do statistic analysis

2012-05-08 Thread york8866
Hi, Rui, I tried your code. It did not work. thanks, -- View this message in context: http://r.789695.n4.nabble.com/Help-deleting-negative-values-in-a-matrix-and-do-statistic-analysis-tp4617792p4618080.html Sent from the R help mailing list archive at Nabble.com.

Re: [R] Help deleting negative values in a matrix, and do statistic analysis

2012-05-08 Thread york8866
Hi, John, the code ran well. however, somehow, the means were not calculated correctly using the following code. test - read.csv(Rtestdataset.csv, as.is=T,header=T) test - data.frame(test) test rowMeans(test) apply(test,1,function(y)mean(y=0)) Is there anything wrong? thanks, -- View this

Re: [R] Help deleting negative values in a matrix, and do statistic analysis

2012-05-08 Thread york8866
Sorry, my mistake. it works very well!!! thanks, Rui Barradas wrote Hello, york8866 wrote Hi, John, the code ran well. however, somehow, the means were not calculated correctly using the following code. test - read.csv(Rtestdataset.csv, as.is=T,header=T) test