Re: [R] R: Redefine default parameter values for help.start()

2015-04-17 Thread Martin Maechler
 paul  paul.domas...@gmail.com
 on Thu, 16 Apr 2015 18:58:12 + writes:

 Because of the setup of R in cygwin, help.start() requires
 the following parameter values:

 help.start(browser=cygstart,remote=R.home())

 Is it possible to make these values the default?

You are building R from the sources, right?

Then, of course it is easily possible: Just modify your version
of the R source code appropriately:

It is file  R/src/library/utils/R/help.start.R

(And you need more changes anyway to make things work under Cygwin;
 but don't ask me about it: I do run R on Windows only very rarely)

 I do not want cygstart to be the browser except as a
 parameter for help.start().

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.


Re: [R-es] Weighted Likelihood

2015-04-17 Thread Víctor Nalda Castellet
Hola Olivier,

Muchísimas gracias por la ayuda, todo entendido. Con tan pocos datos no
puedo pretender obtener lo que me imagino en mi cabeza.

Me has ayudado mucho a entender como funcionaba, todo solucionado!


Un abrazo, y gracias de nuevo.

El 17 de abril de 2015, 9:58, Olivier Nuñez onu...@unex.es escribió:

 Pero, si el modelo lineal lo cubre casi todo!
 Tu modelo es lineal pero generalizado y estás especificando que tus datos
 siguen una Gamma (family=Gamma).
 Lo cual implica por defecto que en promedio la relación entre la variable
 dependiente (datos) y la independiente (num) es inversa no es
 precisamente lineal.
 Si quieres más flexibilidad puedes utilizar splines en la regresión; un
 ejemplo:
 require(splines)
 modelo - svyglm(formula = datos ~ ns(num,2), design = svy, family = Gamma)

 svyplot(formula = datos ~ num, design = svy)
 lines(svy$variables$num, fitted(modelo), col=red)


 Pero, con 10 puntos sólo ganaras inestabilidad en la predicción.


 --
 *De: *Víctor Nalda Castellet victor.nalda.castel...@gmail.com
 *Para: *Olivier Nuñez onu...@unex.es
 *Enviados: *Jueves, 16 de Abril 2015 18:55:17

 *Asunto: *Re: [R-es] Weighted Likelihood

 Hola Olivier,

 No recordaba la función fitted, muchas gracias. Lo que ocurre es que
 claro al utilizar glm, es un modelo lineal. Me gustaría saber si se puede
 ajustar mediante otro tipo de funciones como una Gamma o una normal, ¿sabes
 cómo?

 install.packages(survey)
 library(survey)

 num - c(1:10)
 datos - c(1.1146265, 0.9039153, 0.8374396, 0.7089485, 1.2488793,
 2.5789016, 2.0976523, 0.9748834, 0.2738321, 1.1842141)
 pesos - c(0.7,0.7,1,1,0.02,0.01,1,0.01,0.05,0.2)
 df - cbind.data.frame(num, datos, pesos)

 svy - svydesign(datos, weights = pesos, data = df)

 modelo - svyglm(formula = datos ~ num, design = svy, family = Gamma)
 # family: binomial, gaussian, Gamma, inverse.gaussian, poisson, quasi,
 quasibinomial, quasipoisson

 svyplot(formula = datos ~ num, design = svy)
 lines(svy$variables$num, fitted(modelo), col=red)


 De verdad, muchas gracias por ayudar.

 El 16 de abril de 2015, 18:27, Olivier Nuñez onu...@unex.es escribió:

 Todo parece correcto (siempre que tus pesos son efectivamente weight
 sampling).
 El ajuste, lo puedes obtener de manera estándar con fitted(modelo) y
 vizualizarlo por ejemplo con

 svyplot(formula = datos ~ num, design = svy)
 lines(svy$variables$num,fitted(modelo),col=blue)



 --
 *De: *Víctor Nalda Castellet victor.nalda.castel...@gmail.com
 *Para: *Olivier Nuñez onu...@unex.es
 *Enviados: *Jueves, 16 de Abril 2015 17:25:56

 *Asunto: *Re: [R-es] Weighted Likelihood

 Hola Olivier,

 Muchas gracias por la ayuda, te he entendido perfectamente.

 Tengo un vector de datos y uno de pesos, por ejemplo:

 num - c(1:10)
 datos - c(1.1146265, 0.9039153, 0.8374396, 0.7089485, 1.2488793,
 2.5789016, 2.0976523, 0.9748834, 0.2738321, 1.1842141)
 pesos - c(0.7,0.7,1,1,0.02,0.01,0.02,0.01,0.05,0.2)
 df - cbind.data.frame(num, datos, pesos)

 Ahora creo el diseño como:

 svy - svydesign(datos, weights = pesos, data = df)

 Y si hago su gráfica puedo ver que unos puntos tienen mayor peso que
 otros, tal y como he especificado en los pesos:

 svyplot(formula = datos ~ num, design = svy)

 Ahora quiero ajustar el modelo mediante una función Gamma, para ello:

 modelo - svyglm(formula = datos ~ num, design = svy, family = Gamma)
 # family: binomial, gaussian, Gamma, inverse.gaussian, poisson, quasi,
 quasibinomial, quasipoisson
 summary(modelo)
 plot(modelo)

 ¿Esto es correcto? ¿Cómo puedo ver el ajuste?


 Muchas gracias, un saludo.

 El 16 de abril de 2015, 11:40, Olivier Nuñez onu...@unex.es escribió:

 No das muchos detalles sobre porque quieres ponderar los datos, pero
 intuyo que es por el diseño.
 Si es así, la función svydesign del paquete te permite especificar bien
 la probabilidad de selección del dato (probs) en la muestra o de manera
 equivalente, o el sampling weight que puedes interpretar como la
 representatividad del dato en la población. Una vez especificado el diseño
 mediante esta función, puedes llevar cualquier análisis estandár de tus
 datos. Un saludo. Olivier

 --
 *De: *Víctor Nalda Castellet victor.nalda.castel...@gmail.com
 *Para: *Olivier Nuñez onu...@unex.es
 *CC: *r-help-es r-help-es@r-project.org
 *Enviados: *Jueves, 16 de Abril 2015 11:25:10
 *Asunto: *Re: [R-es] Weighted Likelihood


 Hola,

 He buscado por el pdf de la documentación qué función es la que me puede
 servir pero no encuentro ninguna.
 ¿Tenías alguna función especifica de ese paquete pensada?


 Un saludo, y muchas gracias por la ayuda.

 El 16 de abril de 2015, 10:45, Víctor Nalda Castellet 
 victor.nalda.castel...@gmail.com escribió:

 ¡Muchas gracias Olivier!


 Un saludo.

 El 16 de abril de 2015, 10:44, Olivier Nuñez onu...@unex.es escribió:

 Mira el paquete survey.
 Un saludo. Olivier

 - Mensaje original -
 De: Víctor Nalda 

Re: [R] How to calculate vif of each term of model in R?

2015-04-17 Thread PIKAL Petr
Hi

I did not see any answer so I try.

Your question lacks some info:

Which vif - car or HH?

answers and comments in line

 -Original Message-
 From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of
 Methekar, Pushpa (GE Transportation, Non-GE)
 Sent: Wednesday, April 08, 2015 10:24 AM
 To: r-help@r-project.org
 Subject: [R] How to calculate vif of each term of model in R?


 I am beginner in R doing modelling in R, I loaded excel sheet in R, i
 have chosen x elements and y elements then fitted model for linear and
 second order regression. Now I have both models. I am bit confused how
 to calculate vif for each term in model like

 e.g model1-lm(y1~x1+x2+.x9) when I am using rms package then it's
 giving me like

 vif(model1)

x1 x2 x3 x4 x5 x6
 x7

  6.679692   1.520271   1.667125   3.618439   4.931810   2.073879
 13.870630

 x8 x9

220.969628 214.034135

 now i want to compare each term with std vif as vif=10 and which will
 satisfy this condition i want to delete that term and update model1. i
 have done something like this

 fun = function(model1) {

  for(i in 1:length(model1)){

   v=vif(model1)

  ss=any(v[i]=10)

here you select only one item from vif, Why do you use any?


 if(ss==1){update(model1,.~.,-v[i])}

 else{print(no update)}


Why do you change i here?

  i-i+1

 }



 return(model1)

   }


if you want to get rid of all terms bigger than some threshold in once you can 
use

sel - which(vif(model1)10)

and select values for update possibly by

update(model1,.~. - names(vif(model1))[sel])

or if you want to get rid one by one you can use

vmax - which.max(vif(model1))
and check if max vif value is bigger than 10.

vif(model1)[vmax]=10

If it is just update with

- names(vif(model1))[vmax])

if it is not do not update.

All of this untested.

Cheers
Petr

 fun(model1)

 but giving error as

 Error in if (ss == 1) { : missing value where TRUE/FALSE needed.

 please tell me how do i solve this problem.



   [[alternative HTML version deleted]]

 __
 R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
 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.


Tento e-mail a jakékoliv k němu připojené dokumenty jsou důvěrné a jsou určeny 
pouze jeho adresátům.
Jestliže jste obdržel(a) tento e-mail omylem, informujte laskavě neprodleně 
jeho odesílatele. Obsah tohoto emailu i s přílohami a jeho kopie vymažte ze 
svého systému.
Nejste-li zamýšleným adresátem tohoto emailu, nejste oprávněni tento email 
jakkoliv užívat, rozšiřovat, kopírovat či zveřejňovat.
Odesílatel e-mailu neodpovídá za eventuální škodu způsobenou modifikacemi či 
zpožděním přenosu e-mailu.

V případě, že je tento e-mail součástí obchodního jednání:
- vyhrazuje si odesílatel právo ukončit kdykoliv jednání o uzavření smlouvy, a 
to z jakéhokoliv důvodu i bez uvedení důvodu.
- a obsahuje-li nabídku, je adresát oprávněn nabídku bezodkladně přijmout; 
Odesílatel tohoto e-mailu (nabídky) vylučuje přijetí nabídky ze strany příjemce 
s dodatkem či odchylkou.
- trvá odesílatel na tom, že příslušná smlouva je uzavřena teprve výslovným 
dosažením shody na všech jejích náležitostech.
- odesílatel tohoto emailu informuje, že není oprávněn uzavírat za společnost 
žádné smlouvy s výjimkou případů, kdy k tomu byl písemně zmocněn nebo písemně 
pověřen a takové pověření nebo plná moc byly adresátovi tohoto emailu případně 
osobě, kterou adresát zastupuje, předloženy nebo jejich existence je adresátovi 
či osobě jím zastoupené známá.

This e-mail and any documents attached to it may be confidential and are 
intended only for its intended recipients.
If you received this e-mail by mistake, please immediately inform its sender. 
Delete the contents of this e-mail with all attachments and its copies from 
your system.
If you are not the intended recipient of this e-mail, you are not authorized to 
use, disseminate, copy or disclose this e-mail in any manner.
The sender of this e-mail shall not be liable for any possible damage caused by 
modifications of the e-mail or by delay with transfer of the email.

In case that this e-mail forms part of business dealings:
- the sender reserves the right to end negotiations about entering into a 
contract in any time, for any reason, and without stating any reasoning.
- if the e-mail contains an offer, the recipient is entitled to immediately 
accept such offer; The sender of this e-mail (offer) excludes any acceptance of 
the offer on the part of the recipient containing any amendment or variation.
- the sender insists on that the respective contract is concluded only upon an 
express mutual agreement on 

[R] [off-topic] R Homepage

2015-04-17 Thread Jinsong Zhao

Hi there,

It's a off-topic post. It seems that the R home page changed a lot. 
There are no plot at the right frame. Why are they removed? Will it or 
an alternative be back in future?


Another question is about the ``What's New?'' page. The latest 
announcement is not archived in that page. In the last year, I always 
checked the latest announcement from that page. It's updated in time 
than http://cran.r-project.org/doc/manuals/r-release/NEWS.html


Best,
Jinsong

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.


Re: [R] melt function chooses wrong id variable with large datasets

2015-04-17 Thread PIKAL Petr
Yes

It could be. But anyway, if you wanted to melt your frame and be sure to have 
norm column added to months column you shall use

melt(dataset, id.vars=NULL, na.rm=TRUE)

construction.

Without it and considering data you sent I get

 head(dd.m0)
norm variable value
1   45.8713463281901  januari  38.1
2 24.047250681782984  januari  32.4
3 3.7533684144746324  januari  34.5
4 38.594241119279324  januari  20.7
5 26.391897460120358  januari  21.5
6 61.746470001194638  januari  23.1
...
without this id.vars=NULL parameter.

Cheers
Petr

PS. Keep your post to Rhelp - others may learn from it and anothers can provide 
you with more elaborated explanation.


From: Joachim Audenaert [mailto:joachim.audena...@pcsierteelt.be]
Sent: Friday, April 17, 2015 8:23 AM
To: PIKAL Petr
Subject: RE: [R] melt function chooses wrong id variable with large datasets

Hello,

I upgraded R tot version 3.1.3 and now everything in the script works 
perfectly. Could the troubles be due to the fact that I was running an older 
version?

Met vriendelijke groeten - With kind regards,

Joachim Audenaert
onderzoeker gewasbescherming - crop protection researcher

PCS | proefcentrum voor sierteelt - ornamental plant research


Schaessestraat 18, 9070 Destelbergen, Belgi�
T: +32 (0)9 353 94 71 | F: +32 (0)9 353 94 95
E: joachim.audena...@pcsierteelt.bemailto:joachim.audena...@pcsierteelt.be | 
W: www.pcsierteelt.behttp://www.pcsierteelt.be/



From:PIKAL Petr petr.pi...@precheza.czmailto:petr.pi...@precheza.cz
To:Joachim Audenaert 
joachim.audena...@pcsierteelt.bemailto:joachim.audena...@pcsierteelt.be
Cc:r-help@r-project.orgmailto:r-help@r-project.org 
r-help@r-project.orgmailto:r-help@r-project.org
Date:16/04/2015 13:41
Subject:RE: [R]  melt function chooses wrong id variable with large 
datasets




Hi

With this dataset I get

 dd.m0-melt(dataset, na.rm=T)
Using norm as id variables
 head(dd.m0)
norm variable value
1   45.8713463281901  januari  38.1
2 24.047250681782984  januari  32.4
3 3.7533684144746324  januari  34.5
4 38.594241119279324  januari  20.7
5 26.391897460120358  januari  21.5
6 61.746470001194638  januari  23.1

or

dd.m-melt(dataset, id.vars=NULL, na.rm=T)

 head(dd.m)
  variable value
1  januari  38.1
2  januari  32.4
3  januari  34.5
4  januari  20.7
5  januari  21.5
6  januari  23.1
 tail(dd.m)
variable  value
255 norm  4.856812959269508
256 norm 5.3982910143166514
257 norm 46.553976273304215
258 norm 17.566272518985429
259 norm 20.552451905814117
260 norm 61.894775704479279

The latter will put norm to the same column as months. Is it intended?

Maybe you want

 dd.m1-melt(dataset[,-13], na.rm=T)
No id variables; using all as measure variables
 head(dd.m1)
  variable value
1  januari  38.1
2  januari  32.4
3  januari  34.5
4  januari  20.7
5  januari  21.5
6  januari  23.1
 tail(dd.m1)
variable value
235 december  20.7
236 december  30.9
237 december  36.2
238 december  21.0
239 december  20.2
240 december  21.3

Cheers
Petr

From: Joachim Audenaert [mailto:joachim.audena...@pcsierteelt.be]
Sent: Thursday, April 16, 2015 1:13 PM
To: PIKAL Petr
Cc: r-help@r-project.orgmailto:r-help@r-project.org
Subject: RE: [R] melt function chooses wrong id variable with large datasets

Hello,

This is a part of my dataset:

structure(list(januari = c(38.1, 32.4, 34.5, 20.7, 21.5, 23.1,
29.7, 36.6, 36.1, 20.6, 20.4, 30.1, 38.7, 41.4, 37, 36, 37, 38,
23, 26.7), februari = c(31.5, 36.2, 38.2, 26.4, 20.9, 21.5, 30.2,
33.4, 32.6, 22.2, 21.7, 30, 35.7, 32.8, 39.3, 25.5, 23, 19.9,
21.3, 20.8), maart = c(34.2, 27, 24.2, 19.9, 19.7, 21.5, 30.6,
30, 19, 19.6, 20.6, 23.6, 17.9, 17.3, 21.4, 24.1, 20.9, 30.1,
32.6, 21.3), april = c(26.3, 29.6, 30.3, 23.6, 28.4, 20.7, 24.1,
27.3, 23.2, 18.3, 24.6, 27.4, 20.4, 18.1, 25.2, 19.8, 21, 23.7,
19.6, 18.1), mei = c(23.7, 24, 17.2, 23.2, 25.2, 17.2, 16, 15.6,
13.4, 16, 16.8, 14.6, 19.4, 21, 19.5, 18.5, 13.3, 13.7, 14.3,
14.1), juni = c(17.7, 14.2, 16.6, 15.7, 13.7, 14.7, 13.1, 12.9,
15.4, 11.9, 15.2, 15.3, 16.5, 16.1, 11.7, 11.2, 11.5, 10.8, 16.1,
14.8), juli = c(15.7, 14.5, 10.8, 10.5, 13.4, 12.2, 13.2, 13,
12.4, 13.1, 9.8, 10.5, 13.4, 11, 13.1, 15, 16.7, 16.1, 18.2,
15.7), augustus = c(12.9, 12.8, 15.2, 14.5, 17.2, 14.5, 14.4,
11, 13.1, 13.6, 14.6, 12.7, 13.6, 12.7, 15.5, 17.4, 15.2, 14.2,
17.7, 19.2), september = c(15.6, 15.5, 15.9, 15.1, 16, 19.4,
21.5, 23.7, 18.7, 23.8, 18, 16.2, 18.5, 20.6, 18.3, 22.5, 26.9,
19.4, 15.9, 20.5), oktober = c(21.4, 20.8, 14, 17, 23, 26.4,
19.6, 22.7, 26.9, 14.7, 15.2, 19.8, 26.9, 20.2, 14.3, 14.8, 18.5,
21.7, 21.4, 21.8), november = c(24.7, 26.2, 29, 21.6, 17.1, 16.9,
19.1, 24.7, 25.4, 19.8, 18.2, 16.3, 17, 17.7, 15.5, 14.7, 15.8,
19.9, 20.4, 23.3), december = c(19.8, 27, 21, 33, 22.6, 28.3,
21.1, 19, 17.3, 27, 30.2, 24.8, 17.9, 17.9, 20.7, 30.9, 36.2,
21, 20.2, 21.3), norm = 

Re: [R] How to calculate vif of each term of model in R?

2015-04-17 Thread PIKAL Petr
Hi

 -Original Message-
 From: Methekar, Pushpa (GE Transportation, Non-GE)
 [mailto:pushpa.methe...@ge.com]
 Sent: Friday, April 17, 2015 1:12 PM
 To: PIKAL Petr
 Subject: RE: How to calculate vif of each term of model in R?

 Hi Petr,
 You got my problem ,the solution which u specified is little good but
 with


 update(model1,.~. - names(vif(model1))[vmax])



 I won't be able to update my model .
 Instead I have to write like


  update(model1,.~. - x8)


maybe something like

fun = function(model1) {

vmax - which.max(vif(model1))

while( vif(model1)[vmax]=10) {

model1 - update(model1,.~. - names(vif(model1))[vmax]))
vmax - which.max(vif(model1))

}

return(model1)

}

I am not sure about cycle (i did not use while in R for a while).

Without some data I cannot check syntax so it is up to you.

Cheers
Petr



 i.e my x which having highest vif value.
 Each time for removing highest x .i  have to explicitly write ..-
 x8) So is there any way to avoid this?




 Thanks,
 Pushpa

 -Original Message-
 From: PIKAL Petr [mailto:petr.pi...@precheza.cz]
 Sent: Friday, April 17, 2015 4:16 PM
 To: Methekar, Pushpa (GE Transportation, Non-GE)
 Subject: RE: How to calculate vif of each term of model in R?

 Comments to your first mail which are among lines and directly related
 to your code.

 I specifically mentioned it

  answers and comments in line

 If you have my first respond you can find them easier then now as they
 are buried within your mail.

 Cheers
 Petr


  -Original Message-
  From: Methekar, Pushpa (GE Transportation, Non-GE)
  [mailto:pushpa.methe...@ge.com]
  Sent: Friday, April 17, 2015 12:10 PM
  To: PIKAL Petr
  Subject: RE: How to calculate vif of each term of model in R?
 
  What comments are you talking about?
 
  -Original Message-
  From: PIKAL Petr [mailto:petr.pi...@precheza.cz]
  Sent: Friday, April 17, 2015 3:38 PM
  To: Methekar, Pushpa (GE Transportation, Non-GE)
  Cc: r-help@r-project.org
  Subject: RE: How to calculate vif of each term of model in R?
 
  Did you follow my advice/comments?
 
  Cheers
  Petr
 
 
   -Original Message-
   From: Methekar, Pushpa (GE Transportation, Non-GE)
   [mailto:pushpa.methe...@ge.com]
   Sent: Friday, April 17, 2015 11:43 AM
   To: PIKAL Petr
   Subject: RE: How to calculate vif of each term of model in R?
  
   Car package
  
   -Original Message-
   From: PIKAL Petr [mailto:petr.pi...@precheza.cz]
   Sent: Friday, April 17, 2015 3:11 PM
   To: Methekar, Pushpa (GE Transportation, Non-GE); r-help@r-
  project.org
   Subject: RE: How to calculate vif of each term of model in R?
  
   Hi
  
   I did not see any answer so I try.
  
   Your question lacks some info:
  
   Which vif - car or HH?
  
   answers and comments in line
  
-Original Message-
From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of
Methekar, Pushpa (GE Transportation, Non-GE)
Sent: Wednesday, April 08, 2015 10:24 AM
To: r-help@r-project.org
Subject: [R] How to calculate vif of each term of model in R?
   
   
I am beginner in R doing modelling in R, I loaded excel sheet in
R, i have chosen x elements and y elements then fitted model for
  linear
   and
second order regression. Now I have both models. I am bit
 confused
   how
to calculate vif for each term in model like
   
e.g model1-lm(y1~x1+x2+.x9) when I am using rms package then
   it's
giving me like
   
vif(model1)
   
   x1 x2 x3 x4 x5 x6
x7
   
 6.679692   1.520271   1.667125   3.618439   4.931810   2.073879
13.870630
   
x8 x9
   
   220.969628 214.034135
   
now i want to compare each term with std vif as vif=10 and which
   will
satisfy this condition i want to delete that term and update
  model1.
   i
have done something like this
   
fun = function(model1) {
   
 for(i in 1:length(model1)){
   
  v=vif(model1)
   
 ss=any(v[i]=10)
  
   here you select only one item from vif, Why do you use any?
  
   
if(ss==1){update(model1,.~.,-v[i])}
   
else{print(no update)}
   
  
   Why do you change i here?
  
 i-i+1
   
}
   
   
   
return(model1)
   
  }
   
  
   if you want to get rid of all terms bigger than some threshold in
  once
   you can use
  
   sel - which(vif(model1)10)
  
   and select values for update possibly by
  
   update(model1,.~. - names(vif(model1))[sel])
  
   or if you want to get rid one by one you can use
  
   vmax - which.max(vif(model1))
   and check if max vif value is bigger than 10.
  
   vif(model1)[vmax]=10
  
   If it is just update with
  
   - names(vif(model1))[vmax])
  
   if it is not do not update.
  
   All of this untested.
  
   Cheers
   Petr
  
fun(model1)
   
but giving error as
   
Error in if (ss == 1) { : 

Re: [R] How to calculate vif of each term of model in R?

2015-04-17 Thread PIKAL Petr
Did you follow my advice/comments?

Cheers
Petr


 -Original Message-
 From: Methekar, Pushpa (GE Transportation, Non-GE)
 [mailto:pushpa.methe...@ge.com]
 Sent: Friday, April 17, 2015 11:43 AM
 To: PIKAL Petr
 Subject: RE: How to calculate vif of each term of model in R?

 Car package

 -Original Message-
 From: PIKAL Petr [mailto:petr.pi...@precheza.cz]
 Sent: Friday, April 17, 2015 3:11 PM
 To: Methekar, Pushpa (GE Transportation, Non-GE); r-help@r-project.org
 Subject: RE: How to calculate vif of each term of model in R?

 Hi

 I did not see any answer so I try.

 Your question lacks some info:

 Which vif - car or HH?

 answers and comments in line

  -Original Message-
  From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of
  Methekar, Pushpa (GE Transportation, Non-GE)
  Sent: Wednesday, April 08, 2015 10:24 AM
  To: r-help@r-project.org
  Subject: [R] How to calculate vif of each term of model in R?
 
 
  I am beginner in R doing modelling in R, I loaded excel sheet in R, i
  have chosen x elements and y elements then fitted model for linear
 and
  second order regression. Now I have both models. I am bit confused
 how
  to calculate vif for each term in model like
 
  e.g model1-lm(y1~x1+x2+.x9) when I am using rms package then
 it's
  giving me like
 
  vif(model1)
 
 x1 x2 x3 x4 x5 x6
  x7
 
   6.679692   1.520271   1.667125   3.618439   4.931810   2.073879
  13.870630
 
  x8 x9
 
 220.969628 214.034135
 
  now i want to compare each term with std vif as vif=10 and which
 will
  satisfy this condition i want to delete that term and update model1.
 i
  have done something like this
 
  fun = function(model1) {
 
   for(i in 1:length(model1)){
 
v=vif(model1)
 
   ss=any(v[i]=10)

 here you select only one item from vif, Why do you use any?

 
  if(ss==1){update(model1,.~.,-v[i])}
 
  else{print(no update)}
 

 Why do you change i here?

   i-i+1
 
  }
 
 
 
  return(model1)
 
}
 

 if you want to get rid of all terms bigger than some threshold in once
 you can use

 sel - which(vif(model1)10)

 and select values for update possibly by

 update(model1,.~. - names(vif(model1))[sel])

 or if you want to get rid one by one you can use

 vmax - which.max(vif(model1))
 and check if max vif value is bigger than 10.

 vif(model1)[vmax]=10

 If it is just update with

 - names(vif(model1))[vmax])

 if it is not do not update.

 All of this untested.

 Cheers
 Petr

  fun(model1)
 
  but giving error as
 
  Error in if (ss == 1) { : missing value where TRUE/FALSE needed.
 
  please tell me how do i solve this problem.
 
 
 
[[alternative HTML version deleted]]
 
  __
  R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
  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.



Tento e-mail a jakékoliv k němu připojené dokumenty jsou důvěrné a jsou určeny 
pouze jeho adresátům.
Jestliže jste obdržel(a) tento e-mail omylem, informujte laskavě neprodleně 
jeho odesílatele. Obsah tohoto emailu i s přílohami a jeho kopie vymažte ze 
svého systému.
Nejste-li zamýšleným adresátem tohoto emailu, nejste oprávněni tento email 
jakkoliv užívat, rozšiřovat, kopírovat či zveřejňovat.
Odesílatel e-mailu neodpovídá za eventuální škodu způsobenou modifikacemi či 
zpožděním přenosu e-mailu.

V případě, že je tento e-mail součástí obchodního jednání:
- vyhrazuje si odesílatel právo ukončit kdykoliv jednání o uzavření smlouvy, a 
to z jakéhokoliv důvodu i bez uvedení důvodu.
- a obsahuje-li nabídku, je adresát oprávněn nabídku bezodkladně přijmout; 
Odesílatel tohoto e-mailu (nabídky) vylučuje přijetí nabídky ze strany příjemce 
s dodatkem či odchylkou.
- trvá odesílatel na tom, že příslušná smlouva je uzavřena teprve výslovným 
dosažením shody na všech jejích náležitostech.
- odesílatel tohoto emailu informuje, že není oprávněn uzavírat za společnost 
žádné smlouvy s výjimkou případů, kdy k tomu byl písemně zmocněn nebo písemně 
pověřen a takové pověření nebo plná moc byly adresátovi tohoto emailu případně 
osobě, kterou adresát zastupuje, předloženy nebo jejich existence je adresátovi 
či osobě jím zastoupené známá.

This e-mail and any documents attached to it may be confidential and are 
intended only for its intended recipients.
If you received this e-mail by mistake, please immediately inform its sender. 
Delete the contents of this e-mail with all attachments and its copies from 
your system.
If you are not the intended recipient of this e-mail, you are not authorized to 
use, disseminate, copy or disclose this e-mail in any manner.
The sender of this e-mail shall not be liable for any 

Re: [R] Extracting xml data to data frames

2015-04-17 Thread gavinr
Hi I will re-post using dput to recreate the xml file.  I will need some time
to find a small enough file that demonstrates the problem.

Gavin R.



--
View this message in context: 
http://r.789695.n4.nabble.com/Extracting-xml-data-to-data-frames-tp4705964p4705981.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.


[R-es] Integración de R y C#

2015-04-17 Thread Pedro Herrero Petisco
Hola a todos.

Se me está plantendo la posibilidad de empezar a aprender C# para hacer
algunos programillas (nada grande).
El tema es que el otro día en un mail de esta misma lista alguien (lo
siento, no recuerdo quien) puso un link a un post en el que se hablaba de
la integración entre R y C#.

Por supuesto para llegar a poder hacer esto primero tengo que entender las
bases de .NET y C#, pero me gustaría saber si alguno lo habéis utilizado y
hasta que punto es posible ejecutar código de R en C# y que limitaciones
tiene.

Como primer punto me imagino que será necesario tener instalado R en el
mismo ordenador que se vaya a ejecutar el programa creado en C#, pero...
¿sería posible crear una aplicación de escritorio que funcione en cualquier
PC simplemente teniendo instalado R?

Lo mismo estoy preguntando una tontería pero como digo apenas he visto un
par de manuales pero ya me lo están preguntando en mi entorno.

Muchas gracias a todo

[[alternative HTML version deleted]]

___
R-help-es mailing list
R-help-es@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-help-es


[R] issue with package updates

2015-04-17 Thread Iryna Nikolayeva
Dear R project members,
I have an issue while automatically updating packages.
For the packages installed in my second library, while automatically updating I 
get the following Permission denied” messages(details below).
I suppose I know where this problem comes from:
I had installed a few different versions of R. 
And now I have 2 library paths: 
 .libPaths()
[1] /Users/iryna/Library/R/3.1/library  
[2] /opt/local/Library/Frameworks/R.framework/Versions/3.1/Resources/library”

And for some reason R just doesn’t have rights to update packages in my second 
library.
Do you know why is that? How should I fix this issue? 

Here is the error message:

* installing *source* package ‘mgcv’ ...
** package ‘mgcv’ successfully unpacked and MD5 sums checked
mv: rename 
/opt/local/Library/Frameworks/R.framework/Versions/3.1/Resources/library/mgcv 
to 
/opt/local/Library/Frameworks/R.framework/Versions/3.1/Resources/library/00LOCK-mgcv/mgcv:
 Permission denied
Warning in file.copy(f, instdir, TRUE) :
  problem copying ./NAMESPACE to 
/opt/local/Library/Frameworks/R.framework/Versions/3.1/Resources/library/mgcv/NAMESPACE:
 Permission denied
Warning in file(file, ifelse(append, a, w)) :
  cannot open file 
'/opt/local/Library/Frameworks/R.framework/Versions/3.1/Resources/library/mgcv/DESCRIPTION':
 Permission denied
Error in file(file, ifelse(append, a, w)) : 
  cannot open the connection
ERROR: installing package DESCRIPTION failed for package ‘mgcv’
* removing 
‘/opt/local/Library/Frameworks/R.framework/Versions/3.1/Resources/library/mgcv’




Here are some additional information on my settings:
 version
   _   
platform   x86_64-apple-darwin13.4.0   
arch   x86_64  
os darwin13.4.0
system x86_64, darwin13.4.0
status 
major  3   
minor  1.2 
year   2014
month  10  
day31  
svn rev66913   
language   R   
version.string R version 3.1.2 (2014-10-31)
nickname   Pumpkin Helmet  

Thanks in advance for your help,
—

Iryna Nikolayeva

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.


Re: [R] Fast multiple match function

2015-04-17 Thread Keshav Dhandhania
Hi Jeff,

Indeed the data.table package does provide a much cleaner way to achieve
the same functionality, and a lot of other functionality as bonus.

Thanks for letting me know about it.

On Tue, 7 Apr 2015 at 15:41 Jeff Newmiller jdnew...@dcn.davis.ca.us wrote:

 You might find the data.table package helpful. It uses an index sorted
 with a radix sort and minimizes moving the data around in memory.
 ---
 Jeff NewmillerThe .   .  Go Live...
 DCN:jdnew...@dcn.davis.ca.usBasics: ##.#.   ##.#.  Live
 Go...
   Live:   OO#.. Dead: OO#..  Playing
 Research Engineer (Solar/BatteriesO.O#.   #.O#.  with
 /Software/Embedded Controllers)   .OO#.   .OO#.  rocks...1k
 ---
 Sent from my phone. Please excuse my brevity.

 On April 7, 2015 1:50:39 PM PDT, Keshav Dhandhania kshav...@gmail.com
 wrote:
 Hi all,
 
 Thanks for the responses.
 Herve's example is a good small size example of what I wanted.
 
  y - c(16, -3, -2, 15, 15, 0, 8, 15, -2)
  someCoolFunc(-2, y)
 [1] 3 9
  someCoolFunc(15, y)
 [1] 4 5 8
 
 The requirement is that I want someCoolFunc() to run in O(number of
 matches) time, instead of O(size of y).
 This is because y is big. And I don't know all the queries I want to
 do up-front. And the results of some queries might change the queries
 I want to do in the future.
 
 @David: I hope the above description is more clear.
 @Enrico, Herve: I want both the functionality provided by one function.
 - On repeated calls, fmatch() does give O(1) performance, but it does
 not give all matches.
 - findMatches() gives all matches, but I need to know the entire
 vector x beforehand. I don't have that luxury.
 
 
 I do have something that works now, using split and fmatch (package
 fastmatch). So just posting that in case anyone in the future has the
 same problem.
  y.unique - unique(y)
 
  # create a map from the unique elements of y to the locations of all
 occurrences of the element
  y.map - split(1:length(y), match(y, y.unique))
 
  # write a wrapper function that does a look-up on the unique list.
 and then returns all matches using the map.
  someCoolFunc - function(x) { y.map[[ fmatch(x, y.unique) ]] }
 
 
 
 On Tue, 7 Apr 2015 at 13:21 Hervé Pagès hpa...@fredhutch.org wrote:
 
  Hi Keshav,
 
  findMatches() in the S4Vectors/IRanges packages (Bioconductor) I
 think
  does what you want:
 
 library(IRanges)
 y - c(16L, -3L, -2L, 15L, 15L, 0L, 8L, 15L, -2L)
 x - c(unique(y), 999L)
 hits - findMatches(x, y)
 
  Then:
 
  hits
 Hits object with 9 hits and 0 metadata columns:
   queryHits subjectHits
   integer   integer
   [1] 1   1
   [2] 2   2
   [3] 3   3
   [4] 3   9
   [5] 4   4
   [6] 4   5
   [7] 4   8
   [8] 5   6
   [9] 6   7
   ---
   queryLength: 7
   subjectLength: 9
 
  The Hits object can be turned into a list with:
 
  as.list(hits)
 [[1]]
 [1] 1
 
 [[2]]
 [1] 2
 
 [[3]]
 [1] 3 9
 
 [[4]]
 [1] 4 5 8
 
 [[5]]
 [1] 6
 
 [[6]]
 [1] 7
 
 [[7]]
 integer(0)
 
  H.
 
sessionInfo()
  R version 3.2.0 beta (2015-04-05 r68151)
  Platform: x86_64-unknown-linux-gnu (64-bit)
  Running under: Ubuntu 14.04.2 LTS
 
  locale:
[1] LC_CTYPE=en_US.UTF-8   LC_NUMERIC=C
[3] LC_TIME=en_US.UTF-8LC_COLLATE=en_US.UTF-8
[5] LC_MONETARY=en_US.UTF-8LC_MESSAGES=en_US.UTF-8
[7] LC_PAPER=en_US.UTF-8   LC_NAME=C
[9] LC_ADDRESS=C   LC_TELEPHONE=C
  [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
 
  attached base packages:
  [1] parallel  stats4stats graphics  grDevices utils
 datasets
  [8] methods   base
 
  other attached packages:
  [1] IRanges_2.1.43   S4Vectors_0.5.22 BiocGenerics_0.13.11
 
  loaded via a namespace (and not attached):
  [1] tools_3.2.0
 
  On 04/06/2015 01:56 PM, Keshav Dhandhania wrote:
   Hi,
  
   I know that one can find all occurrences of x in a vector v by
 doing
   which(x == v).
  
   However, if I need to do this again and again, where v is remaining
 the
   same, then this is quite inefficient. In my particular case, I need
 to do
   this millions of times, and length(v) = 100 million.
  
   Does anyone have suggestion on how to go about it?
   I know of a package called fmatch that does the above for the match
   function. But they don't handle multiple matches.
  
   Thanks
  
 [[alternative HTML version deleted]]
  
   __
   R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
   

[R] Are '1st decimal' R rollouts (e.g. 3.2.0) qualitatively different?

2015-04-17 Thread Assaf P. Oron
Hi all,

With the upcoming 3.2.0 upgrade, the question came up among my students,
how often a regular user who is not a cutting-edge developer must upgrade
their R, given that on Windows/Mac this includes the inconvenience of
re-installing dozens of packages.

In this context, I was wondering whether the annual '1st decimal' upgrade
like 3.2.0 is qualitatively different from the interim ones like 3.1.3. In
other words, whether some changes are reserved for those annual upgrades,
or whether all upgrades are essentially equivalent.

Thanks!

Assaf

-- 
Assaf P. Oron, Ph.D.
Senior Statistician, Children's Core for Biomedical Statistics
(206)884-1236, assaf.o...@seattlechildrens.org

Consulting statistician, Seattle DEEDS Project
http://www.duwamishdiesel.org/
Instructor, UW Certificate for Statistical Analysis with R
as...@uw.edu

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.


Re: [R-es] Integración de R y C#

2015-04-17 Thread Javier Marcuzzi
Estimado Pedro Herrero Petisco

Creo que yo puse algo, no recuerdo bien pero debe ser
https://rdotnet.codeplex.com/

Javier Rubén Marcuzzi

El 17 de abril de 2015, 9:20, Pedro Herrero Petisco 
pedroherreropeti...@gmail.com escribió:

 Hola a todos.

 Se me está plantendo la posibilidad de empezar a aprender C# para hacer
 algunos programillas (nada grande).
 El tema es que el otro día en un mail de esta misma lista alguien (lo
 siento, no recuerdo quien) puso un link a un post en el que se hablaba de
 la integración entre R y C#.

 Por supuesto para llegar a poder hacer esto primero tengo que entender las
 bases de .NET y C#, pero me gustaría saber si alguno lo habéis utilizado y
 hasta que punto es posible ejecutar código de R en C# y que limitaciones
 tiene.

 Como primer punto me imagino que será necesario tener instalado R en el
 mismo ordenador que se vaya a ejecutar el programa creado en C#, pero...
 ¿sería posible crear una aplicación de escritorio que funcione en cualquier
 PC simplemente teniendo instalado R?

 Lo mismo estoy preguntando una tontería pero como digo apenas he visto un
 par de manuales pero ya me lo están preguntando en mi entorno.

 Muchas gracias a todo

 [[alternative HTML version deleted]]

 ___
 R-help-es mailing list
 R-help-es@r-project.org
 https://stat.ethz.ch/mailman/listinfo/r-help-es


[[alternative HTML version deleted]]

___
R-help-es mailing list
R-help-es@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-help-es


Re: [R] R: Redefine default parameter values for help.start()

2015-04-17 Thread Paul Domaskis
Martin Maechler maechler at lynne.stat.math.ethz.ch writes:
  paul  paul.domaskis at gmail.com
  on Thu, 16 Apr 2015 18:58:12 + writes:

  Because of the setup of R in cygwin, help.start() requires
  the following parameter values:

  help.start(browser=cygstart,remote=R.home())

  Is it possible to make these values the default?

 You are building R from the sources, right?

No.  I haven't compiled code in a decade, but maybe I should get
back into that.  It won't happen soon, though -- the situation is
that the current cygwin install can't be changed, so installing isn't
an option, at least in the immediate term.  Also, expectations in
terms of time is such that getting a Windows based R would be
preferrable over compiling from scratch, though I must admit that
the latter won't happen any time soon either.

 Then, of course it is easily possible: Just modify your version
 of the R source code appropriately:

 It is file  R/src/library/utils/R/help.start.R

 (And you need more changes anyway to make things work under Cygwin;
  but don't ask me about it: I do run R on Windows only very rarely)

OK, so now I'm not sure I follow.  By source, I normally think C.  But
the file extension above is *.R.  So I tried to take a look at the
file to see what kind of source it is. I can only descend down to
/usr/lib/R/library/utils/R/utils because
/usr/lib/R/library/utils/R/utils is not a directory.  It is a file:

   #  File share/R/nspackloader.R
   #  Part of the R package, http://www.R-project.org
   #
   #  Copyright (C) 1995-2012 The R Core Team
   #
   #  This program is free software; you can redistribute it and/or modify
   #  it under the terms of the GNU General Public License as published by
   #  the Free Software Foundation; either version 2 of the License, or
   #  (at your option) any later version.
   #
   #  This program is distributed in the hope that it will be useful,
   #  but WITHOUT ANY WARRANTY; without even the implied warranty of
   #  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   #  GNU General Public License for more details.
   #
   #  A copy of the GNU General Public License is available at
   #  http://www.r-project.org/Licenses/

   local({
   info - loadingNamespaceInfo()
   pkg - info$pkgname
   ns - .getNamespace(as.name(pkg))
   if (is.null(ns))
   stop(cannot find namespace environment for , pkg, domain = NA);
   dbbase - file.path(info$libname, pkg, R, pkg)
   lazyLoad(dbbase, ns, filter = function(n) n != .__NAMESPACE__.)
   })

I know that I have a lot to learn about R.

Anyway, for now, I am getting around the problem via the following
~/.Rprofile:

   options(papersize=letter)
   options(browser=cygstart)
   options(help_type=html)
   helpstart - function(){help.start(browser=cygstart,remote=R.home())}
   require(astsa)

  I do not want cygstart to be the browser except as a
  parameter for help.start().

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.


[R] R: Idea behind .First() vs. ~/.Rprofile

2015-04-17 Thread paul
I'm ramping up on R, and reading
http://stuff.mit.edu/afs/sipb/project/r-
project/lib/R/library/base/html/Startup.html.
I'm probably wrong about this, but ~/.Rprofile seems to serve the same
purpose as a .First() function.  Why do both exist, and what
considerations go into a decision to choose one over the other for
startup code?

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.


[R] vi[m] editing of past commands in R command line

2015-04-17 Thread Paul Domaskis
I've been told that my messages are being rejected because it is being
posted via nabble in HTML format.  I was advised to re-send this
directly to r-help@r-project.org.  My apologies if you get this twice.

When I use bash + readline and ~/.inputrc contains editing-mode vi,
I can press v to switch to from the command line editing to a full
vi session editing of a command.  This doesn't seem to happen in R.
Is there a configuration setting/file that I can set to get this
behaviour?

Furthermore, when using bash, the fc command allows me to edit the
history of commands, and when I exit the editor, all the remaining
(and likely modified) commands are submitted to the bash shell as if I
typed them at the prompt.  Is there a way to get similar functionality
in R?

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.


Re: [R] Need online version of R help pages

2015-04-17 Thread Collin Lynch
Hi Paul a quick search popped up these:

http://astrostatistics.psu.edu/datasets/R/html/index.html
http://finzi.psych.upenn.edu/
http://r.789695.n4.nabble.com/Online-R-documentation-td1009656.html

Are they what you are looking for?

Collin.

On Thu, Apr 16, 2015 at 5:02 PM, paul paul.domas...@gmail.com wrote:
 The help for the cygwin port of R is buggy and hides random lines of
 text.  Consquently, I've been relying on Google, but it is often not
 clear how directly relevant the info is for the specific command that
 I'm using.  For example, reshape is complicated, and has more than 1
 version.

 Is there an online version of the help pages?

 I tried looking for html versions of the help pages by ferruting
 through the R.home() subtree.  Haven't found them so far.  There are
 package pages in subdirectories package/html/00Index.html, but they
 just contain links to html files that don't reside in my R.home()
 subtree.  There are also subdirectories package/help, but they
 contain pages that I don't recognize (*.rds, *.rdb, *.rdx).

 Getting desparate here, and realizing how the web is not in any way a
 substituted for locally available help pages that you can be confident
 is right for your installation.

 __
 R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
 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.

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.


Re: [R] Need online version of R help pages

2015-04-17 Thread Paul Domaskis
On Fri, Apr 17, 2015 at 3:22 PM, Collin Lynch cfly...@ncsu.edu wrote:
 Hi Paul a quick search popped up these:

 http://astrostatistics.psu.edu/datasets/R/html/index.html
 http://finzi.psych.upenn.edu/
 http://r.789695.n4.nabble.com/Online-R-documentation-td1009656.html

 Are they what you are looking for?

 Collin.

I was looking for a site where I could simply punch in the command and
get the man page without navigating  searching.  But I found a way
around my problem with the help in Cygwin's R port.  In ~/.Rprofile, I
have:

   options(browser=cygstart)
   options(help_type=html)

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.


[R] project.org help mailing list the same as ethz.ch mailing list?

2015-04-17 Thread Paul Domaskis
The page http://www.r-project.org/mail.html says that the mailing list
is r-help_AT_R-project.org (with @ in place of _AT_), but the gmane
page http://gmane.org/list-address.php?group=gmane.comp.lang.r.general
has the mailing list as r-help_AT_stat.math.ethz.ch.

Are these different mailing lists?

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.


Re: [R] R: Idea behind .First() vs. ~/.Rprofile

2015-04-17 Thread Sarah Goslee
Hi,

On Thursday, April 16, 2015, paul paul.domas...@gmail.com wrote:

 I'm ramping up on R, and reading
 http://stuff.mit.edu/afs/sipb/project/r-
 project/lib/R/library/base/html/Startup.html.
 I'm probably wrong about this, but ~/.Rprofile seems to serve the same
 purpose as a .First() function.  Why do both exist, and what
 considerations go into a decision to choose one over the other for
 startup code?


It's the timing and where the info comes from, as that document explains in
great detail.

.Rprofile is read on start-up unless R is specifically told to skip it.

.First() is sourced after it's loaded, and thus must be loaded from
somewhere such as an existing .RData file or a package.

~/.Rprofile is thus most convenient for things you want to have happen in
every R session, while .First() is useful for specific sessions loaded from
saved objects, or for constructing packages. Though on linux, I use a local
.Rprofile if I need per-session options, because I often don't have a saved
.RData file.

Sarah


-- 
Sarah Goslee
http://www.stringpage.com
http://www.sarahgoslee.com
http://www.functionaldiversity.org

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.


Re: [R] R: Redefine default parameter values for help.start()

2015-04-17 Thread paul
Martin Maechler maechler at lynne.stat.math.ethz.ch writes:
  paul  paul.domaskis at gmail.com
  on Thu, 16 Apr 2015 18:58:12 + writes:

  Because of the setup of R in cygwin, help.start() requires
  the following parameter values:

  help.start(browser=cygstart,remote=R.home())

  Is it possible to make these values the default?

 You are building R from the sources, right?

No.  I haven't compiled code in a decade, but maybe I should get
back into that.  It won't happen soon, though -- the situation is
that the current cygwin install can't be changed, so installing isn't
an option, at least in the immediate term.  Also, expectations in
terms of time is such that getting a Windows based R would be
preferrable over compiling from scratch, though I must admit that
the latter won't happen any time soon either.

 Then, of course it is easily possible: Just modify your version
 of the R source code appropriately:

 It is file  R/src/library/utils/R/help.start.R

 (And you need more changes anyway to make things work under Cygwin;
  but don't ask me about it: I do run R on Windows only very rarely)

OK, so now I'm not sure I follow.  By source, I normally think C.  But
the file extension above is *.R.  So I tried to take a look at the
file to see what kind of source it is. I can only descend down to
/usr/lib/R/library/utils/R/utils because
/usr/lib/R/library/utils/R/utils is not a directory.  It is a file:

   #  File share/R/nspackloader.R
   #  Part of the R package, http://www.R-project.org
   #
   #  Copyright (C) 1995-2012 The R Core Team
   #
   #  This program is free software; you can redistribute it and/or modify
   #  it under the terms of the GNU General Public License as published by
   #  the Free Software Foundation; either version 2 of the License, or
   #  (at your option) any later version.
   #
   #  This program is distributed in the hope that it will be useful,
   #  but WITHOUT ANY WARRANTY; without even the implied warranty of
   #  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   #  GNU General Public License for more details.
   #
   #  A copy of the GNU General Public License is available at
   #  http://www.r-project.org/Licenses/

   local({
   info - loadingNamespaceInfo()
   pkg - info$pkgname
   ns - .getNamespace(as.name(pkg))
   if (is.null(ns))
   stop(cannot find namespace environment for , pkg, domain = NA);
   dbbase - file.path(info$libname, pkg, R, pkg)
   lazyLoad(dbbase, ns, filter = function(n) n != .__NAMESPACE__.)
   })

I know that I have a lot to learn about R.

Anyway, for now, I am getting around the problem via the following
~/.Rprofile:

   options(papersize=letter)
   options(browser=cygstart)
   options(help_type=html)
   helpstart - function(){help.start(browser=cygstart,remote=R.home())}
   require(astsa)

  I do not want cygstart to be the browser except as a
  parameter for help.start().

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.


[R] Need online version of R help pages

2015-04-17 Thread paul
The help for the cygwin port of R is buggy and hides random lines of
text.  Consquently, I've been relying on Google, but it is often not
clear how directly relevant the info is for the specific command that
I'm using.  For example, reshape is complicated, and has more than 1
version.

Is there an online version of the help pages?

I tried looking for html versions of the help pages by ferruting
through the R.home() subtree.  Haven't found them so far.  There are
package pages in subdirectories package/html/00Index.html, but they
just contain links to html files that don't reside in my R.home()
subtree.  There are also subdirectories package/help, but they
contain pages that I don't recognize (*.rds, *.rdb, *.rdx).

Getting desparate here, and realizing how the web is not in any way a
substituted for locally available help pages that you can be confident
is right for your installation.

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.


Re: [R] project.org help mailing list the same as ethz.ch mailing list?

2015-04-17 Thread Sarah Goslee
On Friday, April 17, 2015, Paul Domaskis paul.domas...@gmail.com wrote:

 The page http://www.r-project.org/mail.html says that the mailing list
 is r-help_AT_R-project.org (with @ in place of _AT_), but the gmane
 page http://gmane.org/list-address.php?group=gmane.comp.lang.r.general
 has the mailing list as r-help_AT_stat.math.ethz.ch.

 Are these different mailing lists?


They are the same. r-help@r-project.org is the preferred address, but the
mailserver is run out of stat.ethz.ch.

Sarah

Useful info 

 __
 R-help@r-project.org javascript:; mailing list -- To UNSUBSCRIBE and
 more, see
 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.



-- 
Sarah Goslee
http://www.stringpage.com
http://www.sarahgoslee.com
http://www.functionaldiversity.org

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.


Re: [R] R: Idea behind .First() vs. ~/.Rprofile

2015-04-17 Thread paul
Sarah Goslee sarah.goslee at gmail.com writes:
|On Thursday, April 16, 2015, paul paul.domaskis at gmail.com
|wrote:
| I'm ramping up on R, and reading
| http://stuff.mit.edu/afs/sipb/project/r-
| project/lib/R/library/base/html/Startup.html.  I'm probably wrong
| about this, but ~/.Rprofile seems to serve the same purpose as a
| .First() function.  Why do both exist, and what considerations go
| into a decision to choose one over the other for startup code?
|
| It's the timing and where the info comes from, as that document
| explains in great detail.
|
| .Rprofile is read on start-up unless R is specifically told to skip
| it.
|
| .First() is sourced after it's loaded, and thus must be loaded from
| somewhere such as an existing .RData file or a package.
|
| ~/.Rprofile is thus most convenient for things you want to have
| happen in every R session, while .First() is useful for specific
| sessions loaded from saved objects, or for constructing packages.
| Though on linux, I use a local .Rprofile if I need per-session
| options, because I often don't have a saved .RData file.

Thanks, Sarah.  Yes, the documentation has a great deal of detail, but
I needed was your explanation in the final paragraph of your response.

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.


Re: [R] project.org help mailing list the same as ethz.ch mailing list?

2015-04-17 Thread paul
Sarah Goslee sarah.goslee at gmail.com writes:
On Friday, April 17, 2015, Paul Domaskis paul.domaskis at
gmail.com wrote:
 The page http://www.r-project.org/mail.html says that the mailing
 list is r-help_AT_R-project.org (with  at  in place of _AT_), but
 the gmane page
 http://gmane.org/list-address.php?group=gmane.comp.lang.r.general
 has the mailing list as r-help_AT_stat.math.ethz.ch.

 Are these different mailing lists?

 They are the same. r-help at r-project.org is the preferred
 address, but the mailserver is run out of stat.ethz.ch.

Thanks again, Sarah.  Imagine my shock when that suspicion dawned on
me.  I expected to be banned for life for duplicate posts.

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.


Re: [R] Handling NA values in a if statement

2015-04-17 Thread Marc Schwartz
On Apr 17, 2015, at 5:23 PM, Luigi Marongiu marongiu.lu...@gmail.com wrote:
 
 Dear all,
 I have a vector with a certain range of values including infinity and
 NA. I would like to remove the values that are outside a given range
 (lower level = ll and upper level = ul) but I am getting the error due
 to the NA values (missing value where TRUE/FALSE needed). I then
 included the !is.na() but now the resulting error is all NA, as in the
 example.
 In addition, here I have implemented a for loop to scan all the
 elements of the vector, but I should be able to use the sapply();
 however I don't know how to send the ll and ul arguments to sapply().
 Could you please help?
 best regards
 Luigi
 
 EXAMPLE
 
 x - c(-Inf,  Inf,NA,5.9,6.08,5281391136138.75,
 4.35,4.79,
   9474097322.96,3.64,16.42,-12211.11,4.37,
 -1097.79,4.78,
   3.71,32.59,4.01,35.36,3.17,1.61,
 -3678.28,2.9,4.67,
   4.1,348410866.78,5.35,4.3101519459837E+016,
 1467030866.75,
   1.10376094956278E+018,32.55,1.17,5339028670388.94,
  34.14,
   33205967009.57,4.42,1.76,7.08,-8428.84,
 -113491.08,17.81)
 ll - 1
 ul - 45
 
 clipper - function(x, ll, ul) {
  for(i in 1:length(x)) {
if(x[i]  ll) {
  x[i] - NA
} else if(x[i]  ul) {
  x[i] - NA
} else {
  x[i] - x[i]
}
  }
 return(x)
 }
 (X-clipper(x, ll, ul))
 missing value where TRUE/FALSE needed
 
 
 clipper - function(x, ll, ul) {
  for(i in 1:length(x)) {
if(!is.na(x[i])  ll) {
  x[i] - NA
} else if(!is.na(x[i])  ul) {
  x[i] - NA
} else {
  x[i] - x[i]
}
  }
 return(x)
 }
 (X-clipper(x, ll, ul))
 
 [1] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 NA NA NA NA NA
 [28] NA NA NA NA NA NA NA NA NA NA NA NA NA NA


Hi,

Something along the lines of:

 subset(x, is.finite(x)  (x  ll)  (x  ul))
 [1]  5.90  6.08  4.35  4.79  3.64 16.42  4.37  4.78  3.71 32.59  4.01
[12] 35.36  3.17  1.61  2.90  4.67  4.10  5.35 32.55  1.17 34.14  4.42
[23]  1.76  7.08 17.81

or:

 x[is.finite(x)  (x  ll)  (x  ul)]
 [1]  5.90  6.08  4.35  4.79  3.64 16.42  4.37  4.78  3.71 32.59  4.01
[12] 35.36  3.17  1.61  2.90  4.67  4.10  5.35 32.55  1.17 34.14  4.42
[23]  1.76  7.08 17.81


See ?subset and ?is.finite:

 is.finite(x)
 [1] FALSE FALSE FALSE  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE
[12]  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE
[23]  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE
[34]  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE


Regards,

Marc Schwartz

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.


[R] Smart detection of wrap width?

2015-04-17 Thread paul
I suspect that the answer is no, but just in case, is there a way to
have R detect the window width and wrap accordingly?  I don't want to
set an option every time I dock a window or shrink it.

In my ideal paradise, R would not only format output according to
window width, but it would also me to specify a virtual window width.
So if I specify a virtual window width of 200 characters, and the
actual window width is 100, then the output has a carriage return at
the 200 character mark but I only see the 1st 100 characters of each
line of text (the rest being truncated from view).  And of course, the
user would be able to specify when the virtual width mirrors the
actual window width.

I know that this is dreaming in technicolour (which is not that
fantastical these days), but I would be pleasantly surprised if there
was a way to simply have the output wrap according to the actual
window width.

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.


[R] Handling NA values in a if statement

2015-04-17 Thread Luigi Marongiu
Dear all,
I have a vector with a certain range of values including infinity and
NA. I would like to remove the values that are outside a given range
(lower level = ll and upper level = ul) but I am getting the error due
to the NA values (missing value where TRUE/FALSE needed). I then
included the !is.na() but now the resulting error is all NA, as in the
example.
In addition, here I have implemented a for loop to scan all the
elements of the vector, but I should be able to use the sapply();
however I don't know how to send the ll and ul arguments to sapply().
Could you please help?
best regards
Luigi

EXAMPLE

x - c(-Inf,  Inf,NA,5.9,6.08,5281391136138.75,
4.35,4.79,
   9474097322.96,3.64,16.42,-12211.11,4.37,
-1097.79,4.78,
   3.71,32.59,4.01,35.36,3.17,1.61,
-3678.28,2.9,4.67,
   4.1,348410866.78,5.35,4.3101519459837E+016,
1467030866.75,
   1.10376094956278E+018,32.55,1.17,5339028670388.94,
  34.14,
   33205967009.57,4.42,1.76,7.08,-8428.84,
-113491.08,17.81)
ll - 1
ul - 45

clipper - function(x, ll, ul) {
  for(i in 1:length(x)) {
if(x[i]  ll) {
  x[i] - NA
} else if(x[i]  ul) {
  x[i] - NA
} else {
  x[i] - x[i]
}
  }
return(x)
}
(X-clipper(x, ll, ul))
 missing value where TRUE/FALSE needed


clipper - function(x, ll, ul) {
  for(i in 1:length(x)) {
if(!is.na(x[i])  ll) {
  x[i] - NA
} else if(!is.na(x[i])  ul) {
  x[i] - NA
} else {
  x[i] - x[i]
}
  }
return(x)
}
(X-clipper(x, ll, ul))

 [1] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
NA NA NA NA NA
[28] NA NA NA NA NA NA NA NA NA NA NA NA NA NA

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.


Re: [R] Smart detection of wrap width?

2015-04-17 Thread MacQueen, Don
A lot of this depends on what context you are running R in, e.g., Windows
console, Mac console, or command line in a unix-alike. Or within ESS in
emacs. Those are different interfaces supported by, to some extent,
different people, and are based on the underlying capabilities provided by
the operating system.

Have you yet encountered
  options()$width
?
For example,
  options(width=100)
will cause wrapping at 100, at least for certain kinds of output.

In an xterm shell running in an X windows context, I frequently use

setwid - function ()
{
if (!interactive())
return(invisible(NULL))
scon - pipe(stty -a)
stty - scan(scon, what = , sep = ;, quiet = T)
close(scon)
cstr - stty[grep(columns, stty)]
options(width = as.numeric(gsub([^0-9], , cstr, ignore.case = T)))
paste(width =, options()$width, \n)
}


A function I wrote that resets the width option to match the window
widths, and therefore adjusts the wrapping after I resize a windwo.

-- 
Don MacQueen

Lawrence Livermore National Laboratory
7000 East Ave., L-627
Livermore, CA 94550
925-423-1062





On 4/17/15, 3:52 PM, paul paul.domas...@gmail.com wrote:

I suspect that the answer is no, but just in case, is there a way to
have R detect the window width and wrap accordingly?  I don't want to
set an option every time I dock a window or shrink it.

In my ideal paradise, R would not only format output according to
window width, but it would also me to specify a virtual window width.
So if I specify a virtual window width of 200 characters, and the
actual window width is 100, then the output has a carriage return at
the 200 character mark but I only see the 1st 100 characters of each
line of text (the rest being truncated from view).  And of course, the
user would be able to specify when the virtual width mirrors the
actual window width.

I know that this is dreaming in technicolour (which is not that
fantastical these days), but I would be pleasantly surprised if there
was a way to simply have the output wrap according to the actual
window width.

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.


[R] Programming R to avoid loops

2015-04-17 Thread Brant Inman
I have two large data frames with the following structure:

 df1
  id   date test1.result
1  a 2009-08-28  1
2  a 2009-09-16  1
3  b 2008-08-06  0
4  c 2012-02-02  1
5  c 2010-08-03  1
6  c 2012-08-02  0

 df2
  id   date test2.result
1  a 2011-02-03  1
2  b 2011-09-27  0
3  b 2011-09-01  1
4  c 2009-07-16  0
5  c 2009-04-15  0
6  c 2010-08-10  1

I need to match items in df2 to those in df1 with specific matching criteria. I 
have written a looped matching algorithm that works, but it is very slow with 
my large datasets. I am requesting help on making a version of this code that 
is faster and “vectorized so to speak.

My algorithm is currently something like this code. It works but is damn slow.

findTestPairs - function(test1, id1, date1, test2, id2, date2, predays=-30, 
  lagdays=30){
  # Function to find, within subjects, two tests that occur with a timeframe
  #
  # test1 = the reference test result for which matching second tests are sought
  # test2 = the second test result
  # date1 = the date of test1
  # date2 = the date of test2
  # id1   = unique identifier for subject undergoing test 1
  # id2   = unique identifier for subject undergoing test 2
  # predays  = maximum number of days prior to test1 date that test2 date might 
occur
  # lagdays  = maximum number of days after test1 date that test2 date might 
occur

  result - data.frame(matrix(ncol=5, nrow=length(test1)))
colnames(result) - c('id','test1','date','test2count',’test2lag.result')
result$id- id1
result$test1 - test1
result$date  - date1

  for(i in 1:length(test1)){
l - 0# Counter of test2 results that matches test1 within lag interval
m - NA   # Indicator of positive test2 within lag interval

for(j in 1:length(test2)){
  if(id1[i] == id2[j]){   # STEP1: Match IDs
interval - date2[j] - date1[i]
intmatch - ifelse(interval = predays  interval = lagdays, 1, 0)

if(intmatch == 1){# STEP2: Does test2 fall within lag 
interval?
  l - l+1# If test2 within lag interval, count 
it

  if(test2[j] == 1) { # STEP3: Is test 2 positive?
m - 1# If test2 is positive, set indicator 
to 1
  } else {
m - 0
  }
}
  }
}  
result$test2count[i] - l
result$test2lag.result[i] - m
  }  
  return(result)
}  

I would appreciate help on building a faster matching algorithm. I am pretty 
certain that R functions can be used to do this but I do not have a good grasp 
of how to make it work.

Brant Inman
[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.

Re: [R] assign variables to function output

2015-04-17 Thread MacQueen, Don
I don't disagree with the other answers, but I'd like to talk about what I
see as a more underlying issue.

Generally speaking, functions return the value of the last expression
within them.

myfun - function(x) {
  z - sqrt(x)
  2
}

Then
 y - myfun(7)
assigns 2 to y because 2 was the last expression in the function.

myfun - function(z) {
 cat('inside myfun\n')
 y - z-7
 x - 2*z
 sqrt(z)
}

  y - myfun(c(1,4,9))

assigns c(1,2,3) to y because sqrt(z) was the last expression. x and y are
lost and gone forever.

Note that return() was not used, and does not need to be used.

Thus, if you want to return something that includes some of the variables
introduced inside the function, you gather them into a suitable structure
and make that the last expression in the function.

myfun - function(z) {
  y - z-7
  x - 2*z
  list(x=x, y=y, rtz=sqrt(z))
}

Then y - myfun(4) returns a list with three elements whose values are -3,
8, and 2.

Again no use of return(). There are cases where return() is useful, but it
is not needed in simple cases like these.
(and I can't imagine what's awkward about using return(value), but that's
another question)


-Don

-- 
Don MacQueen

Lawrence Livermore National Laboratory
7000 East Ave., L-627
Livermore, CA 94550
925-423-1062





On 4/15/15, 3:17 PM, merm pione...@student.unimelb.edu.au wrote:

Hi!

So I'm trying as the header suggests to assign the value(s) output by a
function to a variable, say 'y'

Problem is from what I gather any variables introduced within the function
are contained and the only output I can get is return(value) which is
awkward to work with. Any suggestions?

Cheers!



--
View this message in context:
http://r.789695.n4.nabble.com/assign-variables-to-function-output-tp470592
0.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.


[R] lag1.plot {astsa} vs. lag.plot {stats}

2015-04-17 Thread Paul Domaskis
I'm following http://www.stat.pitt.edu/stoffer/tsa3/R_toot.htm to ramp
up on both time series and R.  About 40% of the way down, the tutorial
uses lag1.plot from astsa and lag.plot from stats.  The positioning of
the dots look different between the two.  Nothing jumps out at me from
the help pages that explains why they would be different.  Can anyone
confirm this difference, and hopefully suggest explanations?

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.


Re: [R] lag1.plot {astsa} vs. lag.plot {stats}

2015-04-17 Thread Roy Mendelssohn - NOAA Federal
Not certain which plot you are looking at, but my guess is the answer is 
contained somewhere here:

http://www.stat.pitt.edu/stoffer/tsa3/Rissues.htm

in particular perhaps issues 4-5.

-Roy M.
 On Apr 17, 2015, at 7:30 PM, Paul Domaskis paul.domas...@gmail.com wrote:
 
 I'm following http://www.stat.pitt.edu/stoffer/tsa3/R_toot.htm to ramp
 up on both time series and R.  About 40% of the way down, the tutorial
 uses lag1.plot from astsa and lag.plot from stats.  The positioning of
 the dots look different between the two.  Nothing jumps out at me from
 the help pages that explains why they would be different.  Can anyone
 confirm this difference, and hopefully suggest explanations?
 
 __
 R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
 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.

**
The contents of this message do not reflect any position of the U.S. 
Government or NOAA.
**
Roy Mendelssohn
Supervisory Operations Research Analyst
NOAA/NMFS
Environmental Research Division
Southwest Fisheries Science Center
***Note new address and phone***
110 Shaffer Road
Santa Cruz, CA 95060
Phone: (831)-420-3666
Fax: (831) 420-3980
e-mail: roy.mendelss...@noaa.gov www: http://www.pfeg.noaa.gov/

Old age and treachery will overcome youth and skill.
From those who have been given much, much will be expected 
the arc of the moral universe is long, but it bends toward justice -MLK Jr.

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.


Re: [R] Smart detection of wrap width?

2015-04-17 Thread Paul Domaskis
Yes, I found the width option in the help pages, but I was wondering
if there was automatic setting of the wrapping according to the
current window width.

Your function works exactly as I wished.  I'll probably get smarter
with time (I hope) but would it be reasonably good practice to stick
this into ~/.Rprofile?  I don't suppose there is a way to have it
automatically invoked when the window size/positition changes?  (It's
still priceless even without automatic triggering).

On Fri, Apr 17, 2015 at 7:20 PM, MacQueen, Don macque...@llnl.gov
wrote:
 A lot of this depends on what context you are running R in, e.g.,
 Windows console, Mac console, or command line in a unix-alike. Or
 within ESS in emacs. Those are different interfaces supported by, to
 some extent, different people, and are based on the underlying
 capabilities provided by the operating system.

 Have you yet encountered
   options()$width
 ?
 For example,
   options(width=100)
 will cause wrapping at 100, at least for certain kinds of output.

 In an xterm shell running in an X windows context, I frequently use

 setwid - function ()
 {
 if (!interactive())
 return(invisible(NULL))
 scon - pipe(stty -a)
 stty - scan(scon, what = , sep = ;, quiet = T)
 close(scon)
 cstr - stty[grep(columns, stty)]
 options(width = as.numeric(gsub([^0-9], , cstr, ignore.case = T)))
 paste(width =, options()$width, \n)
 }

 A function I wrote that resets the width option to match the window
 widths, and therefore adjusts the wrapping after I resize a windwo.

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.


Re: [R] Need online version of R help pages

2015-04-17 Thread Duncan Murdoch
On 16/04/2015 5:02 PM, paul wrote:
 The help for the cygwin port of R is buggy and hides random lines of
 text.

You've already been told not to use the Cygwin port.  It's buggy in the
help pages, and probably in many other respects as well.  It doesn't
pass the R self-tests.  Don't use it.

Duncan Murdoch

  Consquently, I've been relying on Google, but it is often not
 clear how directly relevant the info is for the specific command that
 I'm using.  For example, reshape is complicated, and has more than 1
 version.
 
 Is there an online version of the help pages?
 
 I tried looking for html versions of the help pages by ferruting
 through the R.home() subtree.  Haven't found them so far.  There are
 package pages in subdirectories package/html/00Index.html, but they
 just contain links to html files that don't reside in my R.home()
 subtree.  There are also subdirectories package/help, but they
 contain pages that I don't recognize (*.rds, *.rdb, *.rdx).
 
 Getting desparate here, and realizing how the web is not in any way a
 substituted for locally available help pages that you can be confident
 is right for your installation.
 
 __
 R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
 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.


__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.


Re: [R] Need online version of R help pages

2015-04-17 Thread Paul Domaskis
With all due respect, Duncan, I can't find the message advising
against using the Cygwin port.  I did find a message about the
mishandling of line endings, and I've asked on the cygwin forum
(as advised).
As I mentioned, I'm in an environment where updates are not possible,
and I'm clarifying now that this means installations are even more
impossible, at least not without extensive adminstrative delay.
Basically, this is what I have to work with.  If anyone can suggest
good ideas for the challenges as-is, that would be much appreciated.
However, given your posts, I fully understand if the answer is no.
On the other hand, simply demanding a solution consisting of a course
of action which is impossible at present...well, it's just impossible.
Having said that, I'll just say that I've managed to exort the powers
that be to install a Windows based version of R, but I have to work
with what I currently have for at least a week.  I should also mention
that I've submitted an update to the mailing list on a workaround for
the R help problem on cygwin.  It might not have propagated to
recipients yet.
I appreciate the further info on the extent of the bugginess of the
cygwin port.
On Fri, Apr 17, 2015 at 9:04 PM, Duncan Murdoch
murdoch.dun...@gmail.com wrote:
On 16/04/2015 5:02 PM, paul wrote:
 The help for the cygwin port of R is buggy and hides random lines
 of text.

 You've already been told not to use the Cygwin port.  It's buggy in
 the help pages, and probably in many other respects as well.  It
 doesn't pass the R self-tests.  Don't use it.

  Consquently, I've been relying on Google, but it is often not
  clear how directly relevant the info is for the specific command
  that I'm using.  For example, reshape is complicated, and has more
  than 1 version.

 Is there an online version of the help pages?

 I tried looking for html versions of the help pages by ferruting
 through the R.home() subtree.  Haven't found them so far.  There
 are package pages in subdirectories package/html/00Index.html,
 but they just contain links to html files that don't reside in my
 R.home() subtree.  There are also subdirectories package/help,
 but they contain pages that I don't recognize (*.rds, *.rdb,
 *.rdx).

 Getting desparate here, and realizing how the web is not in any way
 a substituted for locally available help pages that you can be
 confident is right for your installation.

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.


Re: [R] issue with package updates

2015-04-17 Thread Jim Lemon
Hi Iryna,
The two paths seem to be a user path (one beneath your home
directory) and a system path (one in another branch of the directory
tree). You usually have to have superuser privileges to write files in
the second. In most *NIX systems you use su to become root (the
superuser), and if you can do this, then perform the update.

Jim

On Fri, Apr 17, 2015 at 7:25 PM, Iryna Nikolayeva
iryna.v.nikolay...@gmail.com wrote:
 Dear R project members,
 I have an issue while automatically updating packages.
 For the packages installed in my second library, while automatically updating 
 I get the following Permission denied” messages(details below).
 I suppose I know where this problem comes from:
 I had installed a few different versions of R.
 And now I have 2 library paths:
 .libPaths()
 [1] /Users/iryna/Library/R/3.1/library
 [2] /opt/local/Library/Frameworks/R.framework/Versions/3.1/Resources/library”

 And for some reason R just doesn’t have rights to update packages in my 
 second library.
 Do you know why is that? How should I fix this issue?

 Here is the error message:

 * installing *source* package ‘mgcv’ ...
 ** package ‘mgcv’ successfully unpacked and MD5 sums checked
 mv: rename 
 /opt/local/Library/Frameworks/R.framework/Versions/3.1/Resources/library/mgcv 
 to 
 /opt/local/Library/Frameworks/R.framework/Versions/3.1/Resources/library/00LOCK-mgcv/mgcv:
  Permission denied
 Warning in file.copy(f, instdir, TRUE) :
   problem copying ./NAMESPACE to 
 /opt/local/Library/Frameworks/R.framework/Versions/3.1/Resources/library/mgcv/NAMESPACE:
  Permission denied
 Warning in file(file, ifelse(append, a, w)) :
   cannot open file 
 '/opt/local/Library/Frameworks/R.framework/Versions/3.1/Resources/library/mgcv/DESCRIPTION':
  Permission denied
 Error in file(file, ifelse(append, a, w)) :
   cannot open the connection
 ERROR: installing package DESCRIPTION failed for package ‘mgcv’
 * removing 
 ‘/opt/local/Library/Frameworks/R.framework/Versions/3.1/Resources/library/mgcv’




 Here are some additional information on my settings:
 version
_
 platform   x86_64-apple-darwin13.4.0
 arch   x86_64
 os darwin13.4.0
 system x86_64, darwin13.4.0
 status
 major  3
 minor  1.2
 year   2014
 month  10
 day31
 svn rev66913
 language   R
 version.string R version 3.1.2 (2014-10-31)
 nickname   Pumpkin Helmet

 Thanks in advance for your help,
 —

 Iryna Nikolayeva

 __
 R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
 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.

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.

Re: [R] Are '1st decimal' R rollouts (e.g. 3.2.0) qualitatively different?

2015-04-17 Thread Duncan Murdoch
On 17/04/2015 11:50 AM, Assaf P. Oron wrote:
 Hi all,
 
 With the upcoming 3.2.0 upgrade, the question came up among my students,
 how often a regular user who is not a cutting-edge developer must upgrade
 their R, given that on Windows/Mac this includes the inconvenience of
 re-installing dozens of packages.
 
 In this context, I was wondering whether the annual '1st decimal' upgrade
 like 3.2.0 is qualitatively different from the interim ones like 3.1.3. In
 other words, whether some changes are reserved for those annual upgrades,
 or whether all upgrades are essentially equivalent.

In an x.y.z upgrade, our policy is that a change to z should not break
any well-behaved code, but a change to y or x might do so.  In the case
of 3.2.0, I don't know of anything that is broken relative to 3.1.3, but
there are probably a few obscure things.

Changes to z are almost always a good idea to adopt.  They shouldn't
break anything that isn't taking advantage of bugs, but should fix bugs.

So I would say regular users should *always* adopt changes where z
becomes a value greater than 0.

The question of z=0 is harder.  There are likely to be changes in x.y.0
which are not as well tested as those in other versions.  However, R is
an open source project.  You aren't paying anything for using it.  The
reason it works so well is because so many people use it, and report bugs.

If you choose not to use a z=0 version, you are essentially stealing the
effort of the rest of the community who contribute to testing and
development.  You are also making the z=1 version worse, by not
reporting bugs in the z=0 version.

In the particular case of 3.2.0, there are not a lot of new changes, so
probably not a lot of new bugs, and you may well be better off from a
reliability point of view using it instead of 3.1.3.  This isn't always
true, so you should pay attention to the news about changes in the new
version, and make your decision based on your own circumstances.

Duncan Murdoch

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.


Re: [R] issue with package updates

2015-04-17 Thread Rolf Turner


See below.

On 18/04/15 12:04, Jim Lemon wrote:


Hi Iryna,
The two paths seem to be a user path (one beneath your home
directory) and a system path (one in another branch of the directory
tree). You usually have to have superuser privileges to write files in
the second. In most *NIX systems you use su to become root (the
superuser), and if you can do this, then perform the update.


Jim:

(1) The OP seems to be using a Mac OSX system (which has Unix underlying 
a great deal of gloppedy obfuscating point-and-click crap).


(2) My reading of the help for install.packages() leads me to believe 
that by default the requested package should be installed into the 
*first* entry of .libPaths(), whence no superuser privileges should be 
required.  It is mysterious to me why the system seems to be intent on 
using the *second* entry of .libPaths() so that superuser privileges 
*are* required.


(3) Since this is Mac OSX stuff, the OP might get better mileage by 
posting on R-Sig-Mac.


cheers,

Rolf



Jim

On Fri, Apr 17, 2015 at 7:25 PM, Iryna Nikolayeva
iryna.v.nikolay...@gmail.com wrote:

Dear R project members,
I have an issue while automatically updating packages.
For the packages installed in my second library, while automatically updating I get 
the following Permission denied” messages(details below).
I suppose I know where this problem comes from:
I had installed a few different versions of R.
And now I have 2 library paths:

.libPaths()

[1] /Users/iryna/Library/R/3.1/library
[2] /opt/local/Library/Frameworks/R.framework/Versions/3.1/Resources/library”

And for some reason R just doesn’t have rights to update packages in my second 
library.
Do you know why is that? How should I fix this issue?

Here is the error message:

* installing *source* package ‘mgcv’ ...
** package ‘mgcv’ successfully unpacked and MD5 sums checked
mv: rename 
/opt/local/Library/Frameworks/R.framework/Versions/3.1/Resources/library/mgcv 
to 
/opt/local/Library/Frameworks/R.framework/Versions/3.1/Resources/library/00LOCK-mgcv/mgcv:
 Permission denied
Warning in file.copy(f, instdir, TRUE) :
   problem copying ./NAMESPACE to 
/opt/local/Library/Frameworks/R.framework/Versions/3.1/Resources/library/mgcv/NAMESPACE:
 Permission denied
Warning in file(file, ifelse(append, a, w)) :
   cannot open file 
'/opt/local/Library/Frameworks/R.framework/Versions/3.1/Resources/library/mgcv/DESCRIPTION':
 Permission denied
Error in file(file, ifelse(append, a, w)) :
   cannot open the connection
ERROR: installing package DESCRIPTION failed for package ‘mgcv’
* removing 
‘/opt/local/Library/Frameworks/R.framework/Versions/3.1/Resources/library/mgcv’




Here are some additional information on my settings:

version

_
platform   x86_64-apple-darwin13.4.0
arch   x86_64
os darwin13.4.0
system x86_64, darwin13.4.0
status
major  3
minor  1.2
year   2014
month  10
day31
svn rev66913
language   R
version.string R version 3.1.2 (2014-10-31)
nickname   Pumpkin Helmet

Thanks in advance for your help,
—

Iryna Nikolayeva


--
Rolf Turner
Technical Editor ANZJS
Department of Statistics
University of Auckland
Phone: +64-9-373-7599 ext. 88276
Home phone: +64-9-480-4619

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.