[R] different results between cor and ccf

2024-01-16 Thread Patrick Giraudoux
Dear listers, I am working on a time series but find that for a given non-zero time lag correlations obtained by ccf and cor are different. x <- c(0.85472102802704641, 1.6008990694641689, 2.5019632258894835, 2.514654801253164, 3.3359198688206368, 3.5401357138398208, 2.6304117871193538,

Re: [R] glm.nb and Error in x[good, , drop = FALSE] * w : non-conformable arrays

2023-04-21 Thread Patrick Giraudoux
do not need to carry on with table attributes). Best, Patrick Le 21/04/2023 à 10:08, Ivan Krylov a écrit : > On Fri, 21 Apr 2023 09:02:37 +0200 > Patrick Giraudoux wrote: > >> I meet an error with glm.nb that I cannot explain the origin (and >> find a fix). The model I want to

[R] glm.nb and Error in x[good, , drop = FALSE] * w : non-conformable arrays

2023-04-21 Thread Patrick Giraudoux
Dear Listers, I meet an error with glm.nb that I cannot explain the origin (and find a fix). The model I want to fit is the following: library(MASS) glm.nb(deg~offset(log(durobs))+zone,data=db) and the data.frame is dumped below. Has anyone an idea about what the trouble comes from ? (except

Re: [R] readxl, read_excel: how colon (:) is read ?

2022-04-01 Thread Patrick Giraudoux
This can be made using the TEXT (TEXTE in the French version) function of Excel, hence: TEXT(M2;"HH:MM") Changes the time into text, and it can be imported from R as wanted. Le 01/04/2022 à 08:34, Patrick Giraudoux a écrit : > Absolutely correct ! I checked in Excel and

Re: [R] readxl, read_excel: how colon (:) is read ?

2022-04-01 Thread Patrick Giraudoux
Le 01/04/2022 à 08:40, Jeff Newmiller a écrit : > Both R and Excel assume a date is associated with every time object. In > Excel, when you show a date it is an integer number of days since 1899-12-31 > (due to a mistake made early in programming it). Whenever you show a time, it > it merely

Re: [R] strptime, date and conversion of week number into POSIX

2021-02-22 Thread Patrick Giraudoux
Ligges a écrit : > That monday does not exist. FOr the week before: > > strptime(paste0("2020-52","-1"),format="%Y-%W-%u") > [1] "2020-12-28" > > One week later is no longer in 2020, so there is no 53th week. > > Best, > Uwe Ligges

Re: [R] strptime, date and conversion of week number into POSIX

2021-02-22 Thread Patrick Giraudoux
EST" [41] "2020-10-12 CEST" "2020-10-19 CEST" "2020-10-26 CET" "2020-11-02 CET" [45] "2020-11-09 CET" "2020-11-16 CET" "2020-11-23 CET" "2020-11-30 CET" [49] "2020-12-07 CET" "2020-12-14 CET

[R] strptime, date and conversion of week number into POSIX

2021-02-22 Thread Patrick Giraudoux
Dear all, I have a trouble trying to convert dates  given in character to POSIX. The date is expressed as a year then the week number e.g. "2020-01" (first week of 2020). I thought is can be converted as following: strptime(mydate,format="%Y-%W") %W refering to the week of the year as decimal

Re: [R] dir and pattern = ".r"

2020-02-28 Thread Patrick Giraudoux
Ups... Thank you both. Indeed I must repeat lessons on regular expression... obviously forgotten... Le 28/02/2020 à 18:32, Jeremie Juste a écrit : Hello, you need dir(pattern="\\.r$",ignore.case=TRUE) remember that the pattern is a regular expression. so ".r" is [any single character]r. So

[R] dir and pattern = ".r"

2020-02-28 Thread Patrick Giraudoux
I have this directory contain listed at the page bottom Can somebody tell me why with dir(pattern = ".txt") dir(pattern = ".dbf") etc. I get exactly what I want (a vector with the file names correctly suffixed), but with dir(pattern = ".r") I get this: > dir(pattern=".r") [1] "Article

Re: [R] using a variable and a superscript in a legend

2019-10-20 Thread Patrick Giraudoux
Would be nice to put those two way examples in the documentation of the function 'expression' and 'bquote' in the next R version (we are in the base) for other users  ;-) I am sure many would enjoy. Le 20/10/2019 à 19:15, Patrick Giraudoux a écrit : > Great !  You have helped to so

Re: [R] using a variable and a superscript in a legend

2019-10-20 Thread Patrick Giraudoux
uot;^2) but I think I prefer the as.expression(list()) construction. An alternative tack is this: e <- expression(0,0) e[[1]] <- "sans renard" e[[2]] <- bquote(.(densren) * " ind."/"km"^2) plot(1:100,1:100,type="n") legend(list(x=0,y=10

Re: [R] using a variable and a superscript in a legend

2019-10-20 Thread Patrick Giraudoux
;),bty="n") > > Cheers, > Bert > > > Bert Gunter > > "The trouble with having an open mind is that people keep coming along > and sticking things into it." > -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip ) > >

Re: [R] using a variable and a superscript in a legend

2019-10-20 Thread Patrick Giraudoux
;- 1.25 > > plot(1:10) > > legend (x="center", legend =bquote(.(densren) (ind./km)^2)) > > See ?legend > > Bert Gunter > > "The trouble with having an open mind is that people keep coming along > and sticking things into it." > -- Opus (aka Be

Re: [R] using a variable and a superscript in a legend

2019-10-20 Thread Patrick Giraudoux
t; R plot superscript in legend > > and the first search result was > https://stackoverflow.com/questions/20453408/superscript-r-squared-for-legend > >  which looks like it might address your question. > > On Sun, Oct 20, 2019 at 3:30 PM Patrick Giraudoux > <mailto:patr

[R] using a variable and a superscript in a legend

2019-10-20 Thread Patrick Giraudoux
Dear listers, I am trying to pass an expression inlcuding a variable and a superpscript to a legend. What I want to obtain is e.g. with densren = 1.25 1.25 ind./km^2 I have tried many variants of the following: legend=bquote(.(densren) (ind./km)^2) but if not errors, do obtain 1.25

Re: [R] troubles with foreign:read.dbf

2019-04-20 Thread Patrick Giraudoux
lename is "Mailles_2011a.dbf" > but in the case that fails your filename is "Mailles_2011a.shp" > (different extensions) > > HTH, > Eric > > > On Sat, Apr 20, 2019 at 8:00 PM Patrick Giraudoux > <mailto:patrick.giraud...@univ-fcomte.fr>> wrote

[R] troubles with foreign:read.dbf

2019-04-20 Thread Patrick Giraudoux
Dear listers, I am using the package foreign function read.dbf and meet the following issue: i<-"Mailles_2011a.dbf" dbf<-read.dbf(i) works well BUT if I have a vector such as files <- c("Mailles_2011a.shp", "Mailles_2011p.shp", "Mailles_2012a.shp", "Mailles_2012p.shp", "Mailles_2013a.shp",

[R] Read text files with Chinese characters

2018-12-15 Thread Patrick Giraudoux
Dear listers, There is number of requests about reading Chinese characters from Excel or text files. I had to cope with the issue and wrote a small manual about it. It might not be an optimal solution, but at least it works :-) One can download the pdf at:

[R] Getting a 404 error reading CRAN mirror repository

2017-06-21 Thread Patrick Giraudoux
Dear all, I try to get a CRAN mirror repository working on my Ubuntu trusty plateform. So, including e.g.: deb https://mirror.ibcp.fr/pub/CRAN/bin/linux/ubuntu trusty universe in /etc/apt/source.lst However, on every mirror tried I get: Err https://mirror.ibcp.fr trusty/universe amd64

[R] AIC models are not all fitted to the same number of observation

2012-03-21 Thread Patrick Giraudoux
Hi, Using lme from the package nlme 3.1-103, I meet a strange warning. I am trying to compare to models with: library(nlme) lmez6=lme(lepus~vulpes,random=~1|troncon/an,data=ika_z6_test) lmez60=lme(lepus~1,random=~1|troncon/an,data=ika_z6_test) Both have the same number of observations and

Re: [R] AIC models are not all fitted to the same number of observation

2012-03-21 Thread Patrick Giraudoux
Le 21/03/2012 10:56, Patrick Giraudoux a écrit : Hi, Using lme from the package nlme 3.1-103, I meet a strange warning. I am trying to compare to models with: library(nlme) lmez6=lme(lepus~vulpes,random=~1|troncon/an,data=ika_z6_test) lmez60=lme(lepus~1,random=~1|troncon/an,data=ika_z6_test

[R] some CRAN mirrors not accessible

2011-12-11 Thread Patrick Giraudoux
Dear all, Since some weeks, look like the following CRAN mirrors are no longer accessible for package update: http://cran.univ-lyon1.fr http://mirror.ibcp.fr/pub/CRAN/ update.packages(ask='graphics',checkBuilt=TRUE) Warning: unable to access index for repository

Re: [R] some CRAN mirrors not accessible

2011-12-11 Thread Patrick Giraudoux
in the local directory 'doc'. Now the info about accessibility/availability has been conveyed to the maintainers. Thanks again, On 11/12/2011 17:43, Patrick Giraudoux wrote: Dear all, Since some weeks, look like the following CRAN mirrors are no longer accessible for package update

[R] symbols and legend: how to harmonize point size ?

2011-11-11 Thread Patrick Giraudoux
Hi, I was wondering if it is possible to harmonize the ouput of symbols() and legend() both from the graphics package. Let us take this example: x-runif(10) y-runif(10) z-runif(10) leg-round(seq(min(z),max(z),l=4),2) # 4 values rounded up to 2 decimals for the legend

Re: [R] How to write a shapefile with projection

2011-11-05 Thread Patrick Giraudoux
Hi, Sorry i have put such a detailed question to the list about writing a shapefile with projection. I realized that if i use writeOGR from rgdal and not the other write shapefile functions i can get a shapefile with projection recognized by ArcGIS. The command is (in case anybody wonders):

[R] logistic regression where the independant variable is a ratio

2011-06-12 Thread Patrick Giraudoux
Dear Lister, I have collected data in 6 geographical areas on prevalence of a parasite in humans and in foxes. The results are expressed as a number of positive or negative cases in human and foxes in the following data.frame: Pvtab - structure(list(posHum = c(3, 5, 3, 17, 0, 4), negHum =

[R] how to use # in a rd doc in url address

2009-11-11 Thread Patrick Giraudoux
I am writing a rd doc, and need to use # in a url adress. This would make: \url{http://www..org/myfolder/#myanchor} Of course, I suppose this will not work because # is a special character starting a comment line in the rd dialect. I did not found a similar example in Writing R exentions.

Re: [R] how to use # in a rd doc in url address

2009-11-11 Thread Patrick Giraudoux
- cuncta stricte discussurus - -Ursprüngliche Nachricht- Von: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] Im Auftrag von Patrick Giraudoux Gesendet: Wednesday, November 11, 2009 12:15 PM An: r-help@r-project.org

Re: [R] how to use # in a rd doc in url address

2009-11-11 Thread Patrick Giraudoux
Duncan Murdoch a écrit : On 11/11/2009 12:15 PM, Patrick Giraudoux wrote: I am writing a rd doc, and need to use # in a url adress. This would make: \url{http://www..org/myfolder/#myanchor} That should work. Of course, I suppose this will not work because # is a special character

Re: [R] how to use # in a rd doc in url address

2009-11-11 Thread Patrick Giraudoux
Patrick Giraudoux a écrit : Duncan Murdoch a écrit : On 11/11/2009 12:15 PM, Patrick Giraudoux wrote: I am writing a rd doc, and need to use # in a url adress. This would make: \url{http://www..org/myfolder/#myanchor} That should work. Of course, I suppose this will not work because

[R] rd doc truncated with R 2.10.0

2009-11-08 Thread Patrick Giraudoux
Hi, I am routinely compiling a package and since I have moved to R 2.10.0, it troncates some section texts in the doc: With the following section in the rd file: \details{ The function calls gpsbabel via the system. The gpsbabel program must be present and on the user's PATH for the

Re: [R] rd doc truncated with R 2.10.0

2009-11-08 Thread Patrick Giraudoux
Duncan Murdoch a écrit : On 08/11/2009 12:07 PM, Patrick Giraudoux wrote: Hi, I am routinely compiling a package and since I have moved to R 2.10.0, it troncates some section texts in the doc: With the following section in the rd file: \details{ The function calls gpsbabel via the system

Re: [R] What happen for Negative binomial link in Lmer

2009-11-04 Thread Patrick Giraudoux
Seems the message below and the thread have reveived no attention/answer. The output presented is quite tricky. Looks like if lmer (lme4 0.9975-10) has accepted a negative binomial link with reasonable estimates, although it was not designed for... What can one think about result validity ?

[R] lmer and negative binomial family

2009-10-29 Thread Patrick Giraudoux
Dear listers, One of my former students is trying to fit a model of the negative binomial family with lmer. In the past (two years ago), the following call was working well: m1a-lmer(mapos~ninter+saison+milieu*zone+(1|code),family=neg.bin(0.451),REML=TRUE,data=manu) But now (R version 2.9.2

[R] lmer and negative binomial family

2009-10-29 Thread Patrick Giraudoux
Dear listers, One of my former students is trying to fit a model of the negative binomial family with lmer. In the past (two years ago), the following call was working well: m1a-lmer(mapos~ninter+saison+milieu*zone+(1|code),family=neg.bin(0.451),REML=TRUE,data=manu) But now (R version 2.9.2

Re: [R] lmer and negative binomial family

2009-10-29 Thread Patrick Giraudoux
Patrick Giraudoux a écrit : Dear listers, One of my former students is trying to fit a model of the negative binomial family with lmer. In the past (two years ago), the following call was working well: m1a-lmer(mapos~ninter+saison+milieu*zone+(1|code),family=neg.bin(0.451),REML=TRUE,data

[R] decimal troubles ?

2009-05-12 Thread Patrick Giraudoux
Dear all, I have some trouble with the number of decimals in R (currently R 2.9.0). For instance: options()$digits [1] 3 let me hope that I will get three digits where useful when a number is printed. BUT: 44.25+31.1+50 [1] 125 No way to get the right result 125.35 Can anybody tell me

Re: [R] decimal troubles ?

2009-05-12 Thread Patrick Giraudoux
-Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Patrick Giraudoux Sent: Tuesday, 12 May 2009 8:08 p.m. To: r-help@r-project.org Subject: [R] decimal troubles ? Dear all, I have some trouble with the number of decimals in R

Re: [R] nls, convergence and starting values

2009-03-28 Thread Patrick Giraudoux
Patrick Burns a écrit : Patrick Giraudoux wrote: Bert Gunter a écrit : Based on a simple scatterplot of pourcma vs transat, a 4 parameter logistic looks like wild overfitting, and that may be the source of your problems. Given the huge scatter, a straight line is about as much as would seem

[R] nls, convergence and starting values

2009-03-27 Thread Patrick Giraudoux
in non linear modelling finding appropriate starting values is something like an art... (maybe from somewhere in Crawley , 2007) Here a colleague and I just want to compare different response models to a null model. This has worked OK for almost all the other data sets except that one (dumped

Re: [R] nls, convergence and starting values

2009-03-27 Thread Patrick Giraudoux
Bert Gunter a écrit : Based on a simple scatterplot of pourcma vs transat, a 4 parameter logistic looks like wild overfitting, and that may be the source of your problems. Given the huge scatter, a straight line is about as much as would seem sensible. I think this falls into the Why ever would

[R] Comparison of age categories using contrasts

2009-02-16 Thread Patrick Giraudoux
Dear listers, I would like to compare the levels of a factor with 8 age categories (0,10] (10,20] (20,30] (30,40] (40,50] (50,60] (60,70] (70,90] (however, the factor has not been ordered yet). The default in glm is cont.treatment (for unordered factors) and that leads to compare each level to

Re: [R] Comparison of age categories using contrasts

2009-02-16 Thread Patrick Giraudoux
Greg Snow a écrit : One approach is to create your own contrasts matrix: mycmat - diag(8) mycmat[ row(mycmat) == col(mycmat) + 1 ] - -1 mycmati - solve(mycmat) contrasts(agefactor) - mycmati[,-1] Now when you use agefactor, the intercept will be the first age group and the

[R] Comparison of age categories using contrasts

2009-02-15 Thread Patrick Giraudoux
Dear listers, I would like to compare the levels of a factor with 8 age categories (0,10] (10,20] (20,30] (30,40] (40,50] (50,60] (60,70] (70,90] (however, the factor has not been ordered yet). The default in glm is cont.treatment (for unordered factors) and that leads to compare each level

Re: [R] Coordinate systems for geostatistics in R (imicola)

2008-08-23 Thread Patrick Giraudoux
If you use the spatial objects provided by the sp-package (http://cran.r-project.org/web/packages/sp/vignettes/sp.pdf) you transform your data to other projections using the spTransform package. Thus you will need the rgdal package in complement (it actually includes spTransform). This

[R] svIDE and Tinn-R

2008-05-19 Thread Patrick Giraudoux
Probably an old moon since evoqued one year ago in this link: http://tolstoy.newcastle.edu.au/R/e2/help/07/04/15738.html but I have recently re-installed Tinn-R with R 2.7.0 and forgot to insert options(warn=-1) library(svIDE) ... options(warn=0) in Rprofile.site... and could see that we have

[R] AIC and anova, lme

2008-02-26 Thread Patrick Giraudoux
Dear listers, Here we have a strange result we can hardly cope with. We want to compare a null mixed model with a mixed model with one independent variable. lmmedt1-lme(mediane~1, random=~1|site, na.action=na.omit, data=bdd2) lmmedt9-lme(mediane~log(0.0001+transat), random=~1|site,

Re: [R] AIC and anova, lme

2008-02-26 Thread Patrick Giraudoux
can search the archives specifically with the REML issue... All the best, Patrick On Tue, 2008-02-26 at 14:38 +0100, Patrick Giraudoux wrote: Dear listers, Here we have a strange result we can hardly cope with. We want to compare a null mixed model with a mixed model with one

[R] random location in polygons sp spsample splancs csr

2008-02-17 Thread Patrick Giraudoux
Dear all, I had to place points at random, one in each of larger number of polygons (actually in objects of class 'SpatialPolygonsDataFrame' , see sp library), and tried first to do it using spsample (from sp). Surprisingly, every 5-15 trials, the output was a NULL value. The doc says that

Re: [R] random location in polygons sp spsample splancs csr

2008-02-17 Thread Patrick Giraudoux
Thanks for those detailed explanation and the time taken to write them. The spsample methods for polygons have an iter= argument that can be used to make then try harder, did you try it (with what values - the help page senctence you quote is from the iter= description)? Yes sure, I went up

[R] change in I(x) ? in R 2.6.0

2007-10-25 Thread Patrick Giraudoux
Dear listers, I am trying to use an old script which was working well in the previous R version. It looks like if it no longer works in R.6.0. I have a model of the form: glm(nath2$Positif ~ n + yearday + x + y + I(x^2) + I(y^2) + yearday:x + yearday:y, family = poisson, data = nath2) and

Re: [R] R-2.6.0 and RWinEdt

2007-10-08 Thread Patrick Giraudoux
Installed and tested right now. Works fine, no problem. Thanks, Patrick Uwe Ligges a écrit : Patrick Giraudoux wrote: Dear Listers, I have just installed R-2.6.0 and the RWinEdt package 1.7-6 under Windows XP. wait for 1.7-7 which should appear on CRAN real soon now. Uwe The R

[R] R-2.6.0 and RWinEdt

2007-10-06 Thread Patrick Giraudoux
Dear Listers, I have just installed R-2.6.0 and the RWinEdt package 1.7-6 under Windows XP. The R-WinEdt menu well appears at launching (the command library(RWinEdt) is in .Rprofile), but WinEdt is NOT started automatically (this was not the case in the earlier versions of R). When WinEdt is