[R] inverse normal distribution function
dear all members i want to use inverse normal distribution in R to show the value of variable Z when Z represent the ordered categorical variables. i hope anyone gives me an example on this distribution . thanks to all [[alternative HTML version deleted]] __ R-help@r-project.org mailing list 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] NeweyWest in sandwich-package
On Thu, 17 Apr 2014, Katharina Mersmann wrote: This post was nearly what I was searching for. Im actually trying to reproduce my Stata results in R and don?t overcome the problem of the NeweyWest Estimators. I have quarterly PanelData In Stata i used: newey y x, lag(4) force In R this should be reg1.2-lm(y~x) coeftest(reg1.2, df = Inf, vcov = NeweyWest(reg1.2, lag = 4,prewhite=0)) but i get slightly different Std. Dev. and P-values. Do i use the wrong command? Or the wrong specification? It's hard to say what is the source of the differences without a reproducible example. The most obvious candidate is a degrees of freedom adjustment, though. By default, NeweyWest() divides by n, the sample size. But some implementations also use division by n-k, where k is the number of estimated parameters. So maybe coeftest(reg1.2, df = Inf, vcov = NeweyWest(reg1.2, lag = 4, prewhite = 0, adjust = TRUE)) replicates the Stata results exactly? Note though that the literature usually recommends automatic bandwidth selection and prewhitening (as implemented in the defaults of NeweyWest). I'm not sure whether there are results for the degrees of freedom adjustment. Thanks a lot for your suggestions! Katie Achim Zeileis-4 wrote On Sun, 27 Jun 2010, Jurica Brajkovi? wrote: I want to calculate Newey West robust standard error using NeweyWest. Comparing the results to what I get in STATA, in order to get the same results in I need to specify prewhite=0. Can someone explain what this prewhite command means? It controls whether autocorrelation in the estimating functions should be removed/reduced by using a VAR model. ?NeweyWest says: prewhite: logical or integer. Should the estimating functions be prewhitened? If 'TRUE' or greater than 0 a VAR model of order 'as.integer(prewhite)' is fitted via 'ar' with method 'ols' and 'demean = FALSE'. The default is to use VAR(1) prewhitening. The Details section adds: To obtain the estimator described in Newey West (1987), prewhitening has to be suppressed. References can also be found on the manual page as well as in Section 3.2 of vignette(sandwich, package = sandwich). Z Thanks [[alternative HTML version deleted]] __ R-help@ mailing list https://stat.ethz.ch/mailman/listinfo/r-help https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@ mailing list https://stat.ethz.ch/mailman/listinfo/r-help https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list 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] interpreting weight in meta-analysis of proportion
Prof. Dewey, sorry for the trivial question and many thank for the replay. Using which package? In this case I used the meta package, but I know that for all but the DerSimonian-Laird method the R function rma.uni of R package metafor is called internally. What did you expect the weights to sum to, I wonder. I think that, to better explain the influence of single study in pooling the effect size, the weight are presented as percentage of the sum of total weight of each study, but I ask for a confirm. Nevertheless, I ask if it is possible to obtain for each study the value of the absolute weight, other than the relative weight, or at least the absolute value of the sum of the weights. Sincerely Mario Petretta Department of Translational Medical Sciences Naples University Federico II Italy Message: 2 Date: Thu, 17 Apr 2014 12:43:06 +0100 From: Michael Dewey i...@aghmed.fsnet.co.uk To: petre...@unina.it, r-help@r-project.org Subject: Re: [R] interpreting weight in meta-analysis of proportion Message-ID: zen-1wakio-0009tp...@smarthost01b.mail.zen.net.uk Content-Type: text/plain; charset=us-ascii; format=flowed At 16:30 16/04/2014, petre...@unina.it wrote: Dear all, I use R 3.0 for Windows. I performed a meta-analysis of the prevalence (single proportion) reported in 14 different studyes using the command: res-metaprop(case,n,sm=PFT, comb.fixed=FALSE, comb.random=TRUE, studlab- paste(Study)) Using which package? print(res) A referee ask a brief explanation of the W-statistic reported in the results, in particular, why the summ of the individual weights of all the studies is 100%. What did you expect the weights to sum to, I wonder. Any suggestion is welcome. -- Mario Petretta Department of Translational Medical Sciences Naples University Federico II Italy Michael Dewey i...@aghmed.fsnet.co.uk http://www.aghmed.fsnet.co.uk/home.html __ R-help@r-project.org mailing list 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] inverse normal distribution function
On 18/04/14 15:13, thanoon younis wrote: dear all members i want to use inverse normal distribution in R to show the value of variable Z when Z represent the ordered categorical variables. i hope anyone gives me an example on this distribution (1) Your question makes no sense. The normal distribution has nothing to do (at least not directly) with categorical variables. (2) The inverse cumulative distribution function for the normal distribution is well documented in R. Learn how to search. (3) It would appear that you need to (a) learn some statistics, and (b) learn something about R. (4) Don't expect others to do your work for you. cheers, Rolf Turner __ R-help@r-project.org mailing list 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] interpreting weight in meta-analysis of proportion
On 18.04.2014 13:02, petre...@unina.it wrote: Prof. Dewey, sorry for the trivial question and many thank for the replay. Using which package? In this case I used the meta package, but I know that for all but the DerSimonian-Laird method the R function rma.uni of R package metafor is called internally. What did you expect the weights to sum to, I wonder. I think that, to better explain the influence of single study in pooling the effect size, the weight are presented as percentage of the sum of total weight of each study, but I ask for a confirm. Nevertheless, I ask if it is possible to obtain for each study the value of the absolute weight, other than the relative weight, or at least the absolute value of the sum of the weights. ## This is an example from the examples-section res - metaprop(4:1, c(10, 20, 30, 40), comb.fixed=FALSE, comb.random=TRUE) ## Object res contains a lot of interesting information ## Open ?metaprop and read the section on values str(res) ## Obtaining the random-effects weights res$w.random ## Calculating relative weights manually res$w.random/(sum(res$w.random)) HTH, Bernd __ R-help@r-project.org mailing list 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] Kmodes weighted version shows an error
Hi All! I have a data frame consisting of categorical variables on which I wish to perform kmode clustering with 20 clusters. I am trying to use Kmodes from R package klaR. The code works fine when I set use simple distance for clustering by setting weighted=FALSE in the function kmodes. However it throws an error when I try setting weighted=TRUE. Data frame : Df Zone Price Oc Peek Name Type Efficiency 1 W H Owned 0 TRIPLE Mech low 2 W H Owned 0 DOUBLE Mech low 3 W H Owned 0 TRIPLE Vidl high 4 E L Owned 0 DOUBLE Mechl low 5 S L Owned 0 BLACK Vid low 6 W H Owned 1 QUICK 7 Mech high The actual rows in Df is 5000 code : Kmodres-kmodes(Df, 20, weighted = TRUE ) Error :Error in n_obj[i] - weight[which(names == obj[different[i]])] : replacement has length zero Am i doing something wrong? Thank you in advance for any help. -SB [[alternative HTML version deleted]] __ R-help@r-project.org mailing list 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] plotting a 3D poisson surface with persp package
Hi everyone, I have fitted a poisson GLMM with the fallowing formula: M1 - glmer(ID ~ DE + PR +(1 | Plot/Site), data = DATA, family = poisson) where ID = my dependent variable representing the count of a bird speciesDE = bush height (independent variable)PR = number of preys (independent variable)(1 | Plot/Site) = my random structure This is my output Random effects: Groups NameVariance Std.Dev. Site:Plot (Intercept) 0.5663 0.7525 Plot (Intercept) 0.5778 0.7601 Number of obs: 491, groups: Site:Plot, 41; Plot, 41 Fixed effects:Estimate Std. Error z value Pr(|z|)(Intercept) 0.405560.31162 1.301 0.19311DE -0.143280.02647 -5.413 6.19e-08 ***PR 0.039330.01133 3.470 0.00052 *** Since both the covariate (DE and PR) are significant, my idea is to plot everything in a 3D graph (x = DE; y = PR, z = ID) in persp (i.e. a poisson plane). When I try to do that with some simulated data, I obtain the type of graph that I need, with the poisson surface ad a nice grid on it. The code that I used is: x1 - rnorm (100)x2 - rnorm (100)abc - function ( x1 , x2 ) { y - exp ((1)*((+1 + (-0.2 * x1 + 0.2 * x2 }par(bg =white)x1r - range ( x1 ) x1seq - seq ( x1r [1], x1r[2], length=50)x2r - range ( x2 ) x2seq - seq ( x2r [1], x2r[2], length=50)z - outer(x1seq, x2seq, abc) persp (x = x1seq, y = x2seq, z= z, theta =-30, zlim = c(-0.2,10) ) Nevertheless, when I try to do it with my own data, I obtain the poisson surface, but without the grid! The surface, instead, is colored in black and I can't understand why. The code is: x1 -DATA$DEx2 -DATA$PRabc - function ( x1 , x2 ) { y - exp ((1)*((+0.4055 + (-0.1432 * x1 + 0.0393 * x2 }par(bg =white)x1r - range ( DATA$DE ) x1seq - seq ( x1r [1], x1r[2], length=491) x2r - range ( DATA2$DE) x2seq - seq ( x2r [1], x2r[2], length=491)z - outer(x1seq, x2seq, abc) #I think that the problem is here, because probably I have to do a prediction... but I can't use the predict function because I have random factors... persp (x = x1seq, y = x2seq, z= z, theta =-30, zlim = c(-0.2,10) ) Can someone help me? (I have attached the two graphs)I hope that I have provided enough details, If not please ask. Thanks a lot, Marco __ R-help@r-project.org mailing list 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] Mediation with multilevel data - Random slopes or not?
Hi, I have been using the mediation package in R to test for mediation in multilevel data. My data is as follows: X: continuous, M: binary, and Y: binary (Y:outcome, M: mediator) I'm testing a 1-1-1 mediation. I get different results when I use random slopes in the equations and when I don't. My code is as follows: med.fit - glmer(M ~ X + (1+X | Subject), family = binomial(link = logit), data = data1, control=glmerControl(optimizer=bobyqa, check.conv.sing=warning)) out.fit - glmer(Y ~ M+ X + (1 + M + X | Subject), family = binomial(link = logit), data = data1, control=glmerControl(optimizer=bobyqa, check.conv.sing=warning)) med.out - mediate(med.fit, out.fit, treat = X, mediator = M, sims = 1000) summary(med.out) With one part of my data I get a singular fit error for the out.fit command. When I only use (1|Subject) instead of (1+M+X|Subject), then I don't get this error, but I get totatlly different results in terms of mediation. Could you please help me? Should I use random slopes or not? Is the singular fit error a serious error? (Correlations within data are not very high, around .10-.15). Thank you. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list 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] Extracting Width and Length of Each Shape in EPS File
Can I convert above code into .exe? On Fri, Apr 18, 2014 at 4:53 PM, Muhammad Abdur Rehman Khawaja kh.m.a.reh...@gmail.com wrote: Thank you very much On Thu, Apr 17, 2014 at 4:31 AM, Paul Murrell p...@stat.auckland.ac.nzwrote: Hi Here is a demonstration that might give you some ideas ... library(grImport) PostScriptTrace(flower.ps, flower.xml) flower - readPicture(flower.xml) grid.newpage() grid.picture(flower) # Extract each path, then look at the 'summary' for the path for (i in 1:flower@summary@numPaths) { bb - flower[i]@summary # Draw the result as a check grid.polygon(c(bb@xscale[1], bb@xscale[2], bb@xscale[2], bb@xscale[1]), c(bb@yscale[1], bb@yscale[1], bb@yscale[2], bb@yscale[2]), default.units=native, gp=gpar(col=NA, fill=adjustcolor(i, alpha=.5)), vp=picture.shape::picture.scale) } The flower.ps file in that example is available here ... https://www.stat.auckland.ac.nz/~paul/R/grImport/importFiles.tar.gz Hope that helps. Paul On 04/17/14 10:56, Jeff Newmiller wrote: Have you read the vignettes that accompany that package? You should also read the Posting Guide for this mailing list, as HTML email is not in general a good idea on this list. --- 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 16, 2014 6:35:55 AM PDT, Muhammad Abdur Rehman Khawaja kh.m.a.reh...@gmail.com wrote: Respected Fellows, I need little bit guidance regarding, how Can I Extract/Calculate/Measure width and length of each every shape in .eps file. EPS file is being generated from Adobe Illustrator. I have used grImport Library in R language to import eps file in R environment, but I couldn't understand in which format the data is in and How can I manipulate it. I'll shall be thankful for your cooperation -- Kind Regards Khawaja Muhammad Abdur Rehman Mechatronics Engineer NUST Professional Profile: http://pk.linkedin.com/in/khawajamechatronicscaps/kh.m. a.reh...@gmail.com [[alternative HTML version deleted]] __ R-help@r-project.org mailing list 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 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. -- Dr Paul Murrell Department of Statistics The University of Auckland Private Bag 92019 Auckland New Zealand 64 9 3737599 x85392 p...@stat.auckland.ac.nz http://www.stat.auckland.ac.nz/~paul/ [[alternative HTML version deleted]] __ R-help@r-project.org mailing list 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] Extracting Width and Length of Each Shape in EPS File
Thank you very much On Thu, Apr 17, 2014 at 4:31 AM, Paul Murrell p...@stat.auckland.ac.nzwrote: Hi Here is a demonstration that might give you some ideas ... library(grImport) PostScriptTrace(flower.ps, flower.xml) flower - readPicture(flower.xml) grid.newpage() grid.picture(flower) # Extract each path, then look at the 'summary' for the path for (i in 1:flower@summary@numPaths) { bb - flower[i]@summary # Draw the result as a check grid.polygon(c(bb@xscale[1], bb@xscale[2], bb@xscale[2], bb@xscale[1]), c(bb@yscale[1], bb@yscale[1], bb@yscale[2], bb@yscale[2]), default.units=native, gp=gpar(col=NA, fill=adjustcolor(i, alpha=.5)), vp=picture.shape::picture.scale) } The flower.ps file in that example is available here ... https://www.stat.auckland.ac.nz/~paul/R/grImport/importFiles.tar.gz Hope that helps. Paul On 04/17/14 10:56, Jeff Newmiller wrote: Have you read the vignettes that accompany that package? You should also read the Posting Guide for this mailing list, as HTML email is not in general a good idea on this list. --- 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 16, 2014 6:35:55 AM PDT, Muhammad Abdur Rehman Khawaja kh.m.a.reh...@gmail.com wrote: Respected Fellows, I need little bit guidance regarding, how Can I Extract/Calculate/Measure width and length of each every shape in .eps file. EPS file is being generated from Adobe Illustrator. I have used grImport Library in R language to import eps file in R environment, but I couldn't understand in which format the data is in and How can I manipulate it. I'll shall be thankful for your cooperation -- Kind Regards Khawaja Muhammad Abdur Rehman Mechatronics Engineer NUST Professional Profile: http://pk.linkedin.com/in/khawajamechatronicscaps/kh.m. a.reh...@gmail.com [[alternative HTML version deleted]] __ R-help@r-project.org mailing list 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 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. -- Dr Paul Murrell Department of Statistics The University of Auckland Private Bag 92019 Auckland New Zealand 64 9 3737599 x85392 p...@stat.auckland.ac.nz http://www.stat.auckland.ac.nz/~paul/ [[alternative HTML version deleted]] __ R-help@r-project.org mailing list 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] Difference between times
Hi. I am new to POSIX and I'd like to understand the reason of this difference. dt1 = as.POSIXct(2014-03-29 09.00, format=%Y-%m-%d %H.%M) dt2 = as.POSIXct(2014-03-30 09.00, format=%Y-%m-%d %H.%M) dt2-dt1 dt1[1] 2014-03-29 09:00:00 CET dt2[1] 2014-03-30 09:00:00 CEST dt2-dt1 Time difference of 23 hours This is right, because on Mar 31 at 2 PM we jump directly to 3PM, DST. On the contrary, I don't understand the following: dt1 = as.POSIXct(2014-04-18 09.00, format=%Y-%m-%d %H.%M, tz = CEST) dt2 = as.POSIXct(2014-04-18 09.00, format=%Y-%m-%d %H.%M, tz = GMT) dt1[1] 2014-04-18 09:00:00 CEST dt2[1] 2014-04-18 09:00:00 GMT dt1-dt2Time difference of 0 secs I should expected a time difference of 2 hours, as CEST is GMT+2. Anyone can help me? Thank you, Nicola [[alternative HTML version deleted]] __ R-help@r-project.org mailing list 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] Extracting Width and Length of Each Shape in EPS File
How are we supposed to know what you are capable of? Regardless of the answer to that, I strongly suspect that you would not find that the effort required would yield a result worth your effort. R is really an interpreted language, so your .exe would just be calling the R interpreter for you... none of the configuration details of getting R installed would go away. You would also probably activate some GPL responsibilities if you were to share that .exe with anyone. --- 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 18, 2014 6:49:45 AM PDT, Muhammad Abdur Rehman Khawaja kh.m.a.reh...@gmail.com wrote: Can I convert above code into .exe? On Fri, Apr 18, 2014 at 4:53 PM, Muhammad Abdur Rehman Khawaja kh.m.a.reh...@gmail.com wrote: Thank you very much On Thu, Apr 17, 2014 at 4:31 AM, Paul Murrell p...@stat.auckland.ac.nzwrote: Hi Here is a demonstration that might give you some ideas ... library(grImport) PostScriptTrace(flower.ps, flower.xml) flower - readPicture(flower.xml) grid.newpage() grid.picture(flower) # Extract each path, then look at the 'summary' for the path for (i in 1:flower@summary@numPaths) { bb - flower[i]@summary # Draw the result as a check grid.polygon(c(bb@xscale[1], bb@xscale[2], bb@xscale[2], bb@xscale[1]), c(bb@yscale[1], bb@yscale[1], bb@yscale[2], bb@yscale[2]), default.units=native, gp=gpar(col=NA, fill=adjustcolor(i, alpha=.5)), vp=picture.shape::picture.scale) } The flower.ps file in that example is available here ... https://www.stat.auckland.ac.nz/~paul/R/grImport/importFiles.tar.gz Hope that helps. Paul On 04/17/14 10:56, Jeff Newmiller wrote: Have you read the vignettes that accompany that package? You should also read the Posting Guide for this mailing list, as HTML email is not in general a good idea on this list. --- 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 16, 2014 6:35:55 AM PDT, Muhammad Abdur Rehman Khawaja kh.m.a.reh...@gmail.com wrote: Respected Fellows, I need little bit guidance regarding, how Can I Extract/Calculate/Measure width and length of each every shape in .eps file. EPS file is being generated from Adobe Illustrator. I have used grImport Library in R language to import eps file in R environment, but I couldn't understand in which format the data is in and How can I manipulate it. I'll shall be thankful for your cooperation -- Kind Regards Khawaja Muhammad Abdur Rehman Mechatronics Engineer NUST Professional Profile: http://pk.linkedin.com/in/khawajamechatronicscaps/kh.m. a.reh...@gmail.com [[alternative HTML version deleted]] __ R-help@r-project.org mailing list 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 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. -- Dr Paul Murrell Department of Statistics The University of Auckland Private Bag 92019 Auckland New Zealand 64 9 3737599 x85392 p...@stat.auckland.ac.nz http://www.stat.auckland.ac.nz/~paul/ __ R-help@r-project.org mailing list 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] Difference between times
Hello, The reason why is that you've misspelled CET (not CEST) dt1 = as.POSIXct(2014-04-18 09.00, format=%Y-%m-%d %H.%M, tz = CEST) Warning messages: 1: In strptime(x, format, tz = tz) : unknown timezone 'CEST' 2: In as.POSIXct.POSIXlt(as.POSIXlt(x, tz, ...), tz, ...) : unknown timezone 'CEST' dt2 = as.POSIXct(2014-04-18 09.00, format=%Y-%m-%d %H.%M, tz = GMT) dt1 = as.POSIXct(2014-04-18 09.00, format=%Y-%m-%d %H.%M, tz = CET) dt1-dt2 Time difference of -2 hours Hope this helps, Rui Barradas Em 18-04-2014 17:13, Nicola Sturaro Sommacal escreveu: Hi. I am new to POSIX and I'd like to understand the reason of this difference. dt1 = as.POSIXct(2014-03-29 09.00, format=%Y-%m-%d %H.%M) dt2 = as.POSIXct(2014-03-30 09.00, format=%Y-%m-%d %H.%M) dt2-dt1 dt1[1] 2014-03-29 09:00:00 CET dt2[1] 2014-03-30 09:00:00 CEST dt2-dt1 Time difference of 23 hours This is right, because on Mar 31 at 2 PM we jump directly to 3PM, DST. On the contrary, I don't understand the following: dt1 = as.POSIXct(2014-04-18 09.00, format=%Y-%m-%d %H.%M, tz = CEST) dt2 = as.POSIXct(2014-04-18 09.00, format=%Y-%m-%d %H.%M, tz = GMT) dt1[1] 2014-04-18 09:00:00 CEST dt2[1] 2014-04-18 09:00:00 GMT dt1-dt2Time difference of 0 secs I should expected a time difference of 2 hours, as CEST is GMT+2. Anyone can help me? Thank you, Nicola [[alternative HTML version deleted]] __ R-help@r-project.org mailing list 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 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] Difference between times
On 18/04/2014 19:46, Rui Barradas wrote: Hello, The reason why is that you've misspelled CET (not CEST) Neither CET nor CEST are portable time-zone names. We have not been given the 'at a minimum' information required by the posting guide, so please read ?Sys.timezone on your system. dt1 = as.POSIXct(2014-04-18 09.00, format=%Y-%m-%d %H.%M, tz = CEST) Warning messages: 1: In strptime(x, format, tz = tz) : unknown timezone 'CEST' 2: In as.POSIXct.POSIXlt(as.POSIXlt(x, tz, ...), tz, ...) : unknown timezone 'CEST' dt2 = as.POSIXct(2014-04-18 09.00, format=%Y-%m-%d %H.%M, tz = GMT) dt1 = as.POSIXct(2014-04-18 09.00, format=%Y-%m-%d %H.%M, tz = CET) dt1-dt2 Time difference of -2 hours Hope this helps, Rui Barradas Em 18-04-2014 17:13, Nicola Sturaro Sommacal escreveu: Hi. I am new to POSIX and I'd like to understand the reason of this difference. dt1 = as.POSIXct(2014-03-29 09.00, format=%Y-%m-%d %H.%M) dt2 = as.POSIXct(2014-03-30 09.00, format=%Y-%m-%d %H.%M) dt2-dt1 dt1[1] 2014-03-29 09:00:00 CET dt2[1] 2014-03-30 09:00:00 CEST dt2-dt1 Time difference of 23 hours This is right, because on Mar 31 at 2 PM we jump directly to 3PM, DST. On the contrary, I don't understand the following: dt1 = as.POSIXct(2014-04-18 09.00, format=%Y-%m-%d %H.%M, tz = CEST) dt2 = as.POSIXct(2014-04-18 09.00, format=%Y-%m-%d %H.%M, tz = GMT) dt1[1] 2014-04-18 09:00:00 CEST dt2[1] 2014-04-18 09:00:00 GMT dt1-dt2Time difference of 0 secs I should expected a time difference of 2 hours, as CEST is GMT+2. Anyone can help me? Thank you, Nicola [[alternative HTML version deleted]] __ R-help@r-project.org mailing list 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 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. -- Brian D. Ripley, rip...@stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ R-help@r-project.org mailing list 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] Difference between times
On Apr 18, 2014, at 12:59 PM, Prof Brian Ripley wrote: On 18/04/2014 19:46, Rui Barradas wrote: Hello, The reason why is that you've misspelled CET (not CEST) Neither CET nor CEST are portable time-zone names. We have not been given the 'at a minimum' information required by the posting guide, so please read ?Sys.timezone on your system. Dear Prof; Thanks for the impetus to yet again read that page. Despite frequently reading help pages and in particular reading that one many times, I still was not getting the 'tz' arguments correct on a Mac. I do now see that I was spelling my TZ incorrectly (as Americas/Los_Angeles rather than America/Los_Angeles. Fellow Mac users may face a problem when using the Finder unless they set it up to display hidden ('dot') files. The /usr/ folder is greyed out but it still does open. If I restore my Finder defaults to not show system files and folders, I no longer see that directory and would not have been able to resolve my spelling error on my own: dt2 = as.POSIXct(2014-04-18 09.00, format=%Y-%m-%d %H.%M, tz = America/New_York) dt1 = as.POSIXct(2014-04-18 09.00, format=%Y-%m-%d %H.%M, tz = America/Los_Angeles) dt1-dt2 Time difference of 3 hours I don't suppose a warning could be issued by the as.POSIXct code when a tz argument is not found in the database to let people know that 'UTC' will be the default? -- David. dt1 = as.POSIXct(2014-04-18 09.00, format=%Y-%m-%d %H.%M, tz = CEST) Warning messages: 1: In strptime(x, format, tz = tz) : unknown timezone 'CEST' 2: In as.POSIXct.POSIXlt(as.POSIXlt(x, tz, ...), tz, ...) : unknown timezone 'CEST' dt2 = as.POSIXct(2014-04-18 09.00, format=%Y-%m-%d %H.%M, tz = GMT) dt1 = as.POSIXct(2014-04-18 09.00, format=%Y-%m-%d %H.%M, tz = CET) dt1-dt2 Time difference of -2 hours Hope this helps, Rui Barradas Em 18-04-2014 17:13, Nicola Sturaro Sommacal escreveu: Hi. I am new to POSIX and I'd like to understand the reason of this difference. dt1 = as.POSIXct(2014-03-29 09.00, format=%Y-%m-%d %H.%M) dt2 = as.POSIXct(2014-03-30 09.00, format=%Y-%m-%d %H.%M) dt2-dt1 dt1[1] 2014-03-29 09:00:00 CET dt2[1] 2014-03-30 09:00:00 CEST dt2-dt1 Time difference of 23 hours This is right, because on Mar 31 at 2 PM we jump directly to 3PM, DST. On the contrary, I don't understand the following: dt1 = as.POSIXct(2014-04-18 09.00, format=%Y-%m-%d %H.%M, tz = CEST) dt2 = as.POSIXct(2014-04-18 09.00, format=%Y-%m-%d %H.%M, tz = GMT) dt1[1] 2014-04-18 09:00:00 CEST dt2[1] 2014-04-18 09:00:00 GMT dt1-dt2Time difference of 0 secs I should expected a time difference of 2 hours, as CEST is GMT+2. Anyone can help me? Thank you, Nicola [[alternative HTML version deleted]] __ R-help@r-project.org mailing list 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 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. -- Brian D. Ripley, rip...@stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ R-help@r-project.org mailing list 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. David Winsemius Alameda, CA, USA __ R-help@r-project.org mailing list 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] problem with pip2d() from ptinpoly
Hi, pip2d() doesn't seem to work correctly for me. I have a plot of a triangle that a query point fits inside, but the point is defined as outside the polygon by pip2d. library(ptinpoly) verts - matrix(c(594891,115309,59,117201,594891,117201), ncol=2, byrow=T) query - matrix(c(594885.0,115435.0), ncol=2, byrow=T) pip2d(Vertices = verts, Queries = query) # result = -1 # contrary to -1 output of pip2d, plot shows point lies within triangle plot(c(594400, 595000), c(115000, 117500), type=n) polygon(verts, border=red) points(x=query[,1], y=query[,2], col=blue) Scott Waichler Pacific Northwest National Laboratory Richland, WA, USA __ R-help@r-project.org mailing list 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] problem with pip2d() from ptinpoly
Apparently it matters whether your polygon is defined clockwise or counterclockwise. A point outside your triangle is recognized ... q2 - matrix(c(594893.0,115435.0), ncol=2, byrow=T) pip2d(Vertices = verts, Queries = q2) [1] 1 ... and defining the triangle in counterclockwise sense gives the expected behaviour. v2 - matrix(c(594891,115309,594891,117201,59,117201), ncol=2, byrow=T) pip2d(Vertices = v2, Queries = query) [1] 1 Cheers, B. On 2014-04-18, at 6:00 PM, Waichler, Scott R wrote: Hi, pip2d() doesn't seem to work correctly for me. I have a plot of a triangle that a query point fits inside, but the point is defined as outside the polygon by pip2d. library(ptinpoly) verts - matrix(c(594891,115309,59,117201,594891,117201), ncol=2, byrow=T) query - matrix(c(594885.0,115435.0), ncol=2, byrow=T) pip2d(Vertices = verts, Queries = query) # result = -1 # contrary to -1 output of pip2d, plot shows point lies within triangle plot(c(594400, 595000), c(115000, 117500), type=n) polygon(verts, border=red) points(x=query[,1], y=query[,2], col=blue) Scott Waichler Pacific Northwest National Laboratory Richland, WA, USA __ R-help@r-project.org mailing list 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 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 Example scripts
A few years ago R changed the way help was handled so that the HTML files are no longer available in the library directory. Around that time the R example files that used to be in some of the libraries also vanished. I'm wondering where the r-ex folder went. Is it totally unsupported and gone? Is it hidden in the mysterious rdx or rdb files? In particular I'm looking for the latest example scripts in the baysem package. I don't see them in the source code or the installed library. __ R-help@r-project.org mailing list 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.