[R] For loop with ifelse help

2010-09-22 Thread Pele
Hello R users, I have 2 files (file1 and f2) and I am trying to sum columns 6:10 of a specific row in f2 and append it in file 1 if the state variable in file 1 equals the rowname in f2. Below is an example of the code I wrote using a for loop, but it not working (i.e it only works for the

Re: [R] For loop with ifelse help

2010-09-22 Thread Pele
Hi David - thanks for your suggestion, but I am trying to avoid doing any merging and sorting for this step because the real file I will be working with has about 20 million records. If I can get this loop or something similar to work will be good enough. thanks again.. -- View this message

Re: [R] For loop with ifelse help

2010-09-23 Thread Pele
Hi Sayan, This is exactly what I was looking for - it worked perfectly. Many thanks!! Also, thanks to everyone else for their suggestions. Pele -- View this message in context: http://r.789695.n4.nabble.com/For-loop-with-ifelse-help-tp2550547p2552388.html Sent from the R help mailing list

[R] Comparing data frames and keeping non-matches

2009-03-11 Thread Pele
Hi R users, I am trying to compare 2 data frames by subject and match and save the no matches to an object called nomatch, but I am getting unexpected results... Can anyone tell me how to correct the code to get the expected results shown in the last table? Many thanks in advance for your any

Re: [R] Comparing data frames and keeping non-matches

2009-03-11 Thread Pele
- c(1:11) df2$match - 1 df2$key - paste(df2$subject, df2$match, sep=) ; df2 nomatch - subset(df2, is.element(df2[,key], df1[,key])==FALSE); nomatch rm(list=ls()) Pele wrote: Hi R users, I am trying to compare 2 data frames by subject and match and save the no matches to an object

[R] Data decomposition

2009-03-29 Thread Pele
Hi R users, I have a time series variable that is only available at a monthly level for 1 years that I need to decompose to a weekly time series level - can anyone recommend a R function that I can use to decompose this series? eg. if month1 = 1200 I would to decompose so that the sum of the

[R] How to show variables used in lm function call?

2009-02-03 Thread Pele
Hello R users, I am new to R and am wondering if anyone can help me out with the following issue: I wrote a function to build ts models using different inputs, but when R displays the call for a model, I cannot tell which variables it is using because it shows the arguments instead of the real

[R] Printing all output (text ans plots) to the same postscript document

2009-02-06 Thread Pele
Hello R users, I have been trying to output all my results (text, plots, etc) into the same postscript file as one document, but have been unable to...Can anyone help me improve my simplified version of the code below so that I can accomplish this? Currently I have to output them separately

[R] Output results to a single postscript document

2009-02-06 Thread Pele
Hello R users, I have been trying to output all my results (text, plots, etc) into the same postscript file as one document, but have been unable to...Can anyone help me improve my code below so that I can accomplish this? Currently I have to output them separately then piece them back

Re: [R] Output results to a single postscript document

2009-02-07 Thread Pele
Hello R users, Below is the code and output of what I am trying to do. My goal is to insert/print all items in the chart function into a pdf document. Only the acf and pacf charts gets printed. Again, thanks in advance for any help I can get! options

[R] Outlier Detection for timeseries

2009-02-13 Thread Pele
Hello R users, Can someone tell if there is a package in R that can do outlier detection that give outputs simiilar to what I got from SAS below. Many thanks in advance for any help! Outlier Details

Re: [R] Outlier Detection for timeseries

2009-02-14 Thread Pele
, Level Shifts, or Temporary Changes... The output in the original not is what SAS produces and I was looking for something similar.. R is very new to me (4 weeks) hence still feeling my way around... Many thanks! Pele wrote: Hello R users, Can someone tell if there is a package in R that can

Re: [R] Outlier Detection for timeseries

2009-02-14 Thread Pele
Hi Hans - I tried your suggestion and it worked out well... Many thanks!! Also, thank to everyone else for their suggestions. Hans W. Borchers-4 wrote: Pele drdionc at yahoo.com writes: Hello R users, Can someone tell if there is a package in R that can do outlier detection

[R] Whitening Time Series

2009-02-16 Thread Pele
Hi R users, I am doing cross correlation analysis on 2 time series (call them y-series and x-series) where I need the use the model developed on the x-series to prewhiten the yseries.. Can someone point me to a function/filter in R that would allow me to do that? Thanks in advance for any

Re: [R] Whitening Time Series

2009-02-17 Thread Pele
Hi Bob - your suggesting worked out great... Many thanks! Also, thanks everyone for the other suggestions! Bob McCall wrote: Look in the package forecast for the function Arima. It will do what you want. It's different than arima function in the stats package. Bob Pele wrote: Hi R

[R] Formula that includes previous row values

2009-02-23 Thread Pele
Hi R users, Is there an easy way in R to generate the results table below using table 1 and the formula (simplified version of the real problem)? It would be easy if I knew the R equivalent of SAS's retain function, but could not find one. Thanks in Advance for any help! table1: ID X2

Re: [R] Formula that includes previous row values

2009-02-23 Thread Pele
Center Intermountain Healthcare greg.s...@imail.org 801.408.8111 -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r- project.org] On Behalf Of Pele Sent: Monday, February 23, 2009 1:59 PM To: r-help@r-project.org Subject: [R] Formula that includes

[R] Formatting numeric values in a data frame

2009-02-25 Thread Pele
Hi R users, I have a data frame that contains 10K obs and 200 variables where I am trying to format the numeric columns to look like the output table below (format to 2 decimal places) but I am having no luck.. Can someone tell me the best way to accomplist this? Thanks in advance for any

Re: [R] Formatting numeric values in a data frame

2009-02-25 Thread Pele
x1 x2x3 1 a1 0.01 0.00 12.33 2 b3 0.48 0.00 9.44 3 c1 0.48 0.00 9.44 4 d5 0.48 0.00 9.44 5 e1 0.48 0.00 9.44 6 f2 0.48 0.00 9.44 7 g6 0.33 0.00 9.44 8 h8 0.33 0.00 9.44 9 i2 0.33 0.00 9.44 10 k2 0.33 0.00 9.44 On Wed, Feb 25, 2009 at 4:19 PM, Pele drdi

Re: [R] output formatting

2009-03-04 Thread Pele
, Pele drdi...@yahoo.com wrote: Hi R users, I have an R object with the following attributes: str(sales.bykey1)  'by' int [1:3, 1:2, 1:52] 268 79 118 359 87 147 453 130 81 483 ...  - attr(*, dimnames)=List of 3  ..$ GROUP: chr [1:3] III II I  ..$ year           : chr [1:2] 2006 2007

[R] Date conversion

2009-03-05 Thread Pele
Hi R users, I have a factor variable called date as shown below: Can anyone share the best / most efficient way to extract year and week (e.g. year = 2006, week = 52 for first record, etc..)? My data set has 1 million records. DATE 11DEC2006 11SEP2006 01APR2007 02DEC2007 Thanks in

Re: [R] Date conversion

2009-03-05 Thread Pele
Hi Uwe, You are correct - that was a type O (52) and thanks for you your suggestion that works.. Pele wrote: Hi R users, I have a factor variable called date as shown below: Can anyone share the best / most efficient way to extract year and week (e.g. year = 2006, week = 52

[R] Week value function

2009-03-07 Thread Pele
Hi R users, I am looking for a date function that will give the following: - The number-of-week value is in the range 01-53 - Weeks begin on a Monday and week 1 of the year is the week that includes both January 4th and the first Thursday of the year. If the

Re: [R] Week value function

2009-03-07 Thread Pele
to numeric if desired: nweek.dBY - function(x) as.integer(format(strptime(x, %d%B%Y) , %W)) nweek.dBY(dt) [1] 1 -- David Winsemius On Mar 7, 2009, at 12:34 PM, Pele wrote: Hi R users, I am looking for a date function that will give the following: - The number-of-week value

[R] Merge 10 data frames with 3 id columns that are common to all data frames

2009-03-08 Thread Pele
Hi R users, Can anyone share some example code using merge_all (from the reshape package) to merge 10 data frames into 1 file. Thanks in advance for any help! -- View this message in context:

Re: [R] Merge 10 data frames with 3 id columns that are common to all data frames

2009-03-08 Thread Pele
of this function, thanks. Similar solutions using base functions were proposed recently on http://wiki.r-project.org/rwiki/doku.php?id=tips:data-frames:merge and i've now added this for reference. baptiste On 8 Mar 2009, at 20:23, Pele wrote: Hi R users, Can anyone share some

Re: [R] Merge 10 data frames with 3 id columns that are common to all data frames

2009-03-08 Thread Pele
2 0.183317 31 2.50352 11 HTH, baptiste On 8 Mar 2009, at 23:40, Pele wrote: I tried using merge_all as shown below but I am getting an error ... can anyone tell me what I am doing wrong? The result table below is what I am looking for. DF1 - data.frame(var1 = letters[1:5

[R] Help : glm p-values for a factor predictor

2017-06-29 Thread Benoît PELE
Hello, i am a newby on R and i am trying to make a backward selection on a binomial-logit glm on a large dataset (69000 lines for 145 predictors). After 3 days working, the stepAIC function did not terminate. I do not know if that is normal but i would like to try computing a "homemade"

Re: [R] Help : glm p-values for a factor predictor

2017-06-29 Thread Benoît PELE
ter_Sequoia) --> The predictors between quotes (excepted y) are qualitative ; others are groups of continuous predictors Var_model<-paste0("y ~ ", paste(champ_model_cont[-1],collapse=" + ")) Logit_appr<-glm(formula=Var_model,family=binomial(link="logit"),data=