Re: [R] Get a copy of a matrix only for TRUE entries of a matching size boolean matrix?

2024-05-03 Thread Marc Girondot via R-help
Is it what you want ? mat_letters <- matrix(data=c('A', 'B', 'C', 'D'), ncol=2, byrow=TRUE) mat_bools <- matrix(data=c(FALSE, TRUE, TRUE, FALSE), ncol=2, byrow=TRUE) ifelse(mat_bools, mat_letters, "") ifelse(mat_bools, mat_letters, NA) > ifelse(mat_bools, mat_letters, "") [,1] [,2] [1,]

Re: [R] Looping

2024-02-19 Thread Marc Girondot via R-help
In my package HelpersMG, I have included a function to read in one time all the files of a folder and they are stored in a list: read_folder(   folder = try(file.choose(), silent = TRUE),   file = NULL,   wildcard = "*.*",   read = read.delim,   ... ) In your case, for example:

[R] Try reproduce glmm by hand

2023-12-02 Thread Marc Girondot via R-help
Dear all, In order to be sure I understand glmm correctly, I try to reproduce by hand a simple result. Here is a reproducible code. The questions are in _ Of course I have tried to find the solution using internet but I was not able to find a solution. I have also tried to

Re: [R] creating a time series

2023-10-16 Thread Marc Girondot via R-help
Why did you expect to have 177647 elements ? I found that 177642 is the correct number: Marc baslangic <- as.POSIXct("2017-11-02 13:30:00", tz = "CET") bitis <- as.POSIXct("2022-11-26 23:45:00", tz = "CET")  # zaman_seti <- seq.POSIXt(from = baslangic, to = bitis, by = 60 * 15) y2017_11_02 <-

Re: [R] overlay shaded area in base r plot

2023-09-19 Thread Marc Girondot via R-help
Dear Ani, A solution using my CRAN package HelpersMG; note that yellow is a difficult color to manage correct overlay. It is easier to use red. mean1 <- c(122.194495954369, 118.955256282505, 115.540991140893, 113.116216840647,   111.24053267553, 109.827890459103, 108.523652505026,

[R] only install.packages with type="source" will install packages

2023-09-14 Thread Marc Girondot via R-help
Dear members, Since #2 weeks I have a problem with install.packages() or update.packages(): It seems to work, I have no error, but when I run again update.packages(), the same package is proposed again. Example: > update.packages() insight :  Version 0.19.3 installed in

Re: [R] Count matrix of GSE146049

2023-04-02 Thread Marc Girondot via R-help
Dear Anas Jamshed, This is a list for R, not for specific genomic question using R. You will have more chance to have answers using a genomic list. And when you ask question, it is better to not use abbreviation that only people from that field will understand: TMM ? Marc Le 02/04/2023 à

Re: [R] MLE Estimation of Gamma Distribution Parameters for data with 'zeros'

2023-01-19 Thread Marc Girondot via R-help
Another situation for the presence of 0 is about dosage when concentration is below the detection limit. It is not necessary to discretize the data. We propose a method here: Salvat-Leal I, Cortés-Gómez AA, Romero D, Girondot M (2022) New method for imputation of unquantifiable values using

Re: [R] setting timezone variable permanently...

2022-12-07 Thread Marc Girondot via R-help
You can create a file .Rprofile in your home directory with this command. Each time you will open R, it will run this command. https://support.posit.co/hc/en-us/articles/360047157094-Managing-R-with-Rprofile-Renviron-Rprofile-site-Renviron-site-rsession-conf-and-repos-conf Marc Le 07/12/2022

Re: [R] A Request

2022-06-21 Thread Marc Girondot
_ 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] Creating NA equivalent

2021-12-20 Thread Marc Girondot via R-help
Dear members, I work about dosage and some values are bellow the detection limit. I would like create new "numbers" like LDL (to represent lower than detection limit) and UDL (upper the detection limit) that behave like NA, with the possibility to test them using for example is.LDL() or

Re: [R] Do not show a "message d'avis" that qbeta reports

2021-10-21 Thread Marc Girondot via R-help
ke to offer help, you could contact someone on that list. Duncan Murdoch Indeed. Currently, the French team is just one person, and maybe they will be happy to share the workload or to get another pair of eyes to look at it... Martin Maechler On 20/10/2021 6:47 a.m., Marc Girondot via R-help

Re: [R] Do not show a "message d'avis" that qbeta reports

2021-10-20 Thread Marc Girondot via R-help
Thanks ! It works. So "Warnings" has been translated in French by "Message d'avis :" ! > warning("Essai") Message d'avis : Essai It is not the best translation... I would prefer: "Attention: " Marc Le 20/10/2021 à 12:28, Enrico Schumann a écrit : On

[R] Do not show a "message d'avis" that qbeta reports

2021-10-20 Thread Marc Girondot via R-help
messages). Thanks Marc Girondot q <- qbeta(p=c(0.025, 0.975), shape1 = 3.3108797, shape2 = 0.001) Message d'avis : Dans qbeta(p = c(0.025, 0.975), shape1 = 3.3108797, shape2 = 1e-07) :   qbeta(a, *) =: x0 with |pbeta(x0,*) - alpha| = 0.024997 is not accurate suppressMessages(q &l

[R] Good practice for database with utf-8 string in package

2021-09-16 Thread Marc Girondot via R-help
Hello everyone, I am a little bit stucked on the problem to include a database with utf-8 string in a package. When I submit it to CRAN, it reports NOTES for several Unix system and I try to find a solution (if it exists) to not have these NOTES. The database has references and some names

Re: [R] Plot histogram and lognormal fit on the same time

2021-01-21 Thread Marc Girondot via R-help
f$estimate["meanlog"], sdlog = f$estimate["sdlog"])*400 ) library(HelpersMG) m <- modeled.hist(breaks=histdata$breaks, FUN=plnorm, � meanlog = f$estimate["meanlog"], sdlog = f$estimate["sdlog"], sum = 100) points(m$x, m$y, pch=19

Re: [R] Error in optim with method L-BFGS-B when hessian is TRUE

2020-08-23 Thread Marc Girondot via R-help
no problem... Marc Le 23/08/2020 ?? 11:19, Marc Girondot via R-help a ??crit??: Dear members, I fought for several days against an error I was getting with optim in L-BFGS-B. The error was produced because some parameters were outside the limits defined by upper and lower. After investigation

[R] Error in optim with method L-BFGS-B when hessian is TRUE

2020-08-23 Thread Marc Girondot via R-help
the calculation of the Hessian matrix which does not take into account the upper and lower bounds. It would be nice if this was stated in the optim help within the L-BFGS-B method section. Marc Girondot __ R-help@r-project.org mailing list -- To UNSUBSCRIBE

Re: [R] Having problems with the ifelse and negative numbers

2019-12-10 Thread Marc Girondot via R-help
Here is a test of the different proposed solutions and a new one faster. In conclusion, ifelse much be used with caution: Aini =  runif(100, min=-1,max=1) library(microbenchmark) A <- Aini microbenchmark({B1 <- ifelse( A < 0, sqrt(-A), A )}) # mean = 77.1 A <- Aini microbenchmark({B2 <-

Re: [R] Where is the SD in output of glm with Gaussian distribution

2019-12-09 Thread Marc Girondot via R-help
'log Lik.' -136.4343 (df=2) > AIC(gnul) [1] 276.8687 > -2*logLik(gnul)+2*2 'log Lik.' 276.8687 (df=2) This is not intuitive when to count SD as a parameter (in AIC) or not in df.resuidual ! > > Bert > > On Mon, Dec 9, 2019 at 7:17 AM Marc Girondot via R-help > mai

[R] Where is the SD in output of glm with Gaussian distribution

2019-12-09 Thread Marc Girondot via R-help
Let do a simple glm: > y=rnorm(100) > gnul <- glm(y ~ 1) > gnul$coefficients (Intercept)   0.1399966 The logLik shows the fit of two parameters (DF=2) (intercept) and sd > logLik(gnul) 'log Lik.' -138.7902 (df=2) But where is the sd term in the glm object? If I do the same with optim, I can

Re: [R] How prevent update of a package

2019-12-06 Thread Marc Girondot via R-help
brevity of the message. This message was sent from a > mobile device. > ---- > *From:* R-help on behalf of Marc > Girondot via R-help > *Sent:* Friday, December 6, 2019 1:09 PM > *To:* R-help Mailing List > *Subject:* [R] How prevent update of a package > I use R 3.6

[R] How prevent update of a package

2019-12-05 Thread Marc Girondot via R-help
I use R 3.6.1 in macOSX 10.15.1 (Catalina). I cannot install the last version (3.0-7) of the package raster from source or from binary. In both cases I get ??*** caught segfault *** address 0x31, cause 'memory not mapped' when I try to load it. Same occurs when I use the development version

[R] Raster package crash with segmentation fault

2019-09-27 Thread Marc Girondot via R-help
Dear members, When I load raster 3.0-7 package installed or from source or from binary in r 3.6.1 (macosX 10.14.6), I get a segmentation fault crash: (see below) As someone the same problem and a solution ? Thanks (I have posted this question in R-Sig_GEO list without answer still) >

[R] Bug (?): file.copy() erases 'from' file if the "to" file already exists and is a symlinked file

2019-09-13 Thread Marc Girondot via R-help
If file.copy() is used to replace a symlinked file, it erases the original file and does not copy the file. The original file is lost. > version _ platform x86_64-apple-darwin15.6.0 arch x86_64 os darwin15.6.0

[R] Loading aliased file in MacOSX

2019-09-11 Thread Marc Girondot via R-help
If I try to load data from an alias file made using Cmd+Ctrl+A in finder for MacOSX, I get an error. Symbolic links are working well but sometimes, it is easier to use finder rather than terminal. Has someone a solution to help R to read the original aliased file ? Thanks Here is a

[R] knitr error for small text in pdf (bug)

2019-08-09 Thread Marc Girondot via R-help
Let try this minimal Rmarkdown file --- title: "cex in Rmarkdown" output: word_document --- ```{r} knitr::opts_chunk$set(dev='pdf') ``` ```{r} plot((0:160)/4, 0:160, type="n") text(x=20, y=70, labels =expression(alpha), cex=1e-7) ``` When knitr-red from Rstudio (with r 3.6.1 on MacosX with

[R] SE for all fixed factor effect in GLMM

2018-12-29 Thread Marc Girondot via R-help
Dear members, Let do a example of simple GLMM with x and G as fixed factors and R as random factor: (note that question is the same with GLM or even LM): x <- rnorm(100) y <- rnorm(100) G <- as.factor(sample(c("A", "B", "C", "D"), 100, replace = TRUE)) R <- as.factor(rep(1:25, 4))

Re: [R] Webshot failed to take snapshot in Ubuntu machine

2018-12-18 Thread Marc Girondot via R-help
Hi Christofer, I just try on MacOSX and ubuntu and it works on both: For ubuntu: > Sys.info()   sysname   "Linux"   release   "4.15.0-42-generic"    

Re: [R] High dimensional optimization in R

2018-11-30 Thread Marc Girondot via R-help
I fit also model with many variables (>100) and I get good result when I mix several method iteratively, for example: 500 iterations of Nelder-Mead followed by 500 iterations of BFGS followed by 500 iterations of Nelder-Mead followed by 500 iterations of BFGS etc. until it stabilized. It can

[R] Should package be reinstalled when exterbal library is changed

2018-10-30 Thread Marc Girondot via R-help
Dear R-experts, Some packages need external libraries to be installed. For example ncdf4 needs netcdf library or flextable need pandoc. When there is new version of external library, should the R package be installed again to use the new external version, or do the package finds itself the

Re: [R] studio server on High SIerra

2018-10-21 Thread Marc Girondot via R-help
I post long time ago a post on my blog about this: https://max2.ese.u-psud.fr/epc/conservation/Girondot/Publications/Blog_r/Entrees/2014/8/3_Install_RStudio_server_on_Marverick_MacOSX.html You could try using this base. Marc Le 21/10/2018 à 05:12, Fuchs Ira a écrit : Can I run Rstudio Server

[R] Set attributes for object known by name

2018-10-10 Thread Marc Girondot via R-help
Hello everybody, Has someone the solution to set attribute when variable is known by name ? Thanks a lot Marc Let see this exemple: # The variable name is stored as characters. varname <- "myvarname" assign(x = varname, data.frame(A=1:5, B=2:6)) attributes(myvarname) $names [1] "A" "B"

[R] Strange result for strptime with %p

2018-10-02 Thread Marc Girondot via R-help
Dear members... are these results normal ? For the first one, no problem. I expected this: > strptime("05/01/18 01:00:00 AM", format = ("%m/%d/%y %I:%M:%S %p"), tz="Asia/Jayapura") [1] "2018-05-01 01:00:00 WIT" For this one, it is ok also: > strptime("05/01/18 01:00:00 AM", format =

Re: [R] sub/grep question: extract year

2018-08-09 Thread Marc Girondot
quot;, subtext) # return 1980 subtext <- "bla 2010 bla" sub(pattern.year, "\\1\\2", subtext) # return 2010 subtext <- "bla 1010 bla" sub(pattern.year, "\\1\\2", subtext) # return bla 1010 bla subtext <- "bla 3010 bla" sub(pattern.year, "

Re: [R] sub/grep question: extract year

2018-08-09 Thread Marc Girondot via R-help
"\\1\\2", subtext) # return 1980 subtext <- "bla 2010 bla" sub(pattern.year, "\\1\\2", subtext) # return 2010 subtext <- "bla 1010 bla" sub(pattern.year, "\\1\\2", subtext) # return bla 1010 bla subtext <- "bla 3010 bla" sub(patter

[R] sub/grep question: extract year

2018-08-09 Thread Marc Girondot via R-help
Hi everybody, I have some questions about the way that sub is working. I hope that someone has the answer: 1/ Why the second example does not return an empty string ? There is no match. subtext <- "-1980-" sub(".*(1980).*", "\\1", subtext) # return 1980 sub(".*(1981).*", "\\1", subtext) #

Re: [R] progress of a function...

2018-07-06 Thread Marc Girondot via R-help
Take a look at the pbmcapply package. It does what you need. Marc Le 06/07/2018 à 11:37, akshay kulkarni a écrit : dear members, I want to use svMisc package in R to check how my function is progressing. It has the following syntax: f <- function(x){ for (i in

Re: [R] Question

2018-04-15 Thread Marc Girondot via R-help
Le 15/04/2018 à 17:56, alireza daneshvar a écrit : break-down point Can you explain more what you plan to do and give an example of what you have tried to do until now to do a "break down point" in R. Perhaps a "break down point" is common in your field, but I have no idea about what it is

Re: [R] Bivariate Normal Distribution Plots

2018-04-13 Thread Marc Girondot via R-help
Try this code: # Standard deviations and correlation sig_x <- 1 sig_y <- 2 rho_xy <- 0.7 # Covariance between X and Y sig_xy <- rho_xy * sig_x *sig_y # Covariance matrix Sigma_xy <- matrix(c(sig_x ^ 2, sig_xy, sig_xy, sig_y ^ 2), nrow = 2, ncol = 2) # Load the mvtnorm package

[R] Fail to save an object using name as string

2018-04-09 Thread Marc Girondot via R-help
Dear list member, I think that I have detected a strange behavior of the save() command: > year <- "2000" > assign(paste0("Var_", year), list(A=10, B=20)) > get(paste0("Var_", year)) $A [1] 10 $B [1] 20 # At this point all is ok, I have created a list of name Var_2000 > save(paste0("Var_",

Re: [R] R 3.4.4, internet access fails on Windows XP

2018-03-21 Thread Marc Girondot via R-help
To solve similar problem, I just install Lubuntu 17.10 on an old PC (i686) and I am astonished by the reactivity of the computer... it has a second life. The main problem is that Rstudio Desktop 32 bits is no more supported for Ubuntu 32bits computers but the solution using Rstudio Server 32

[R] Warning for LC_CTYPE when R is ran through ssh

2018-03-14 Thread Marc Girondot via R-help
ot; [Previously saved workspace restored] > print(1) [1] 1 Has someone a solution to not get this warning when a code is ran through ssh ? Thanks Marc Girondot __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.

Re: [R] Names of variables needed in newdata for predict.glm

2018-03-07 Thread Marc Girondot via R-help
Hi, Some try: > names(mi$xlevels) [1] "f" > all.vars(mi$formula) [1] "D" "x" "f" "Y" > names(mx$xlevels) [1] "f" > all.vars(mx$formula) [1] "D" "x" "f" When offset is indicated out of the formula, it does not work... Marc Le 07/03/2018 à 06:20, Bendix Carstensen a écrit : I would like to

Re: [R] [FORGED] Re: SE for all levels (including reference) of a factor atfer a GLM

2018-02-16 Thread Marc Girondot via R-help
Le 16/02/2018 à 10:24, Peter Dalgaard a écrit : To give a short answer to the original question: On 16 Feb 2018, at 05:02 , Rolf Turner wrote: In order to ascribe unique values to the parameters, one must apply a "constraint". With the "treatment contrasts" the

[R] SE for all levels (including reference) of a factor atfer a GLM

2018-02-15 Thread Marc Girondot via R-help
Dear R-er, I try to get the standard error of fitted parameters for factors with a glm, even the reference one: a <- runif(100) b <- sample(x=c("0", "1", "2"), size=100, replace = TRUE) df <- data.frame(A=a, B=b, stringsAsFactors = FALSE) g <- glm(a ~ b, data=df) summary(g)$coefficients # I

[R] format integer numbers with leading 0

2018-01-04 Thread Marc Girondot via R-help
Dear R-er, I would like format integer number as characters with leading 0 for a fixed width, for example: 1 shoud be "01" 2 shoud be "02" 20 should be "20" Now I use: x <- c(1, 2, 20) gsub(" ", "0", format(x, width=2)) But I suspect more elegant way could be done directly with format

[R] format integer numbers with leading 0

2018-01-04 Thread Marc Girondot via R-help
Dear R-er, I would like format integer number as characters with leading 0 for a fixed width, for example: 1 shoud be "01" 2 shoud be "02" 20 should be "20" Now I use: x <- c(1, 2, 20) gsub(" ", "0", format(x, width=2)) But I suspect more elegant way could be done directly with format

[R] Order of methods for optimx

2017-12-31 Thread Marc Girondot via R-help
Dear R-er, For a non-linear optimisation, I used optim() with BFGS method but it stopped regularly before to reach a true mimimum. It was not a problem with limit of iterations, just a local minimum. I was able sometimes to reach better minimum using several rounds of optim(). Then I moved

Re: [R] Draw Overlapping Circles with shaded tracks

2017-12-31 Thread Marc Girondot via R-help
Another solution: library("HelpersMG") plot(0:10,type="n",axes=FALSE,xlab="",ylab="", asp=1) ellipse(center.x = 3, center.y = 5, radius.x = 5, radius.y = 5, lwd=10, col=NA, border=rgb(red = 1, green = 0, blue=0, alpha = 0.5)) ellipse(center.x = 8, center.y = 5, radius.x = 5, radius.y = 5,

Re: [R] Help with dates

2017-12-28 Thread Marc Girondot via R-help
tml and provide commented, minimal, self-contained, reproducible code. -- ______ Marc Girondot, Pr Laboratoire Ecologie, Systématique et Evolution Equipe de Conservation des Populations et des Communautés CNRS, AgroParisTech et Université Paris-Sud 11 , UMR 8079 Bâtiment 362 91405 Orsay Cede

Re: [R] chi-square distribution table

2017-12-19 Thread Marc Girondot via R-help
Le 18/12/2017 à 15:41, HATMZAHARNA via R-help a écrit : Please could you tell me how to make code to make chi-square distribution table? Please help __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see

Re: [R] Shiny App inside R Package

2017-09-17 Thread Marc Girondot via R-help
I have this working in my package embryogrowth available in CRAN. I have a function to call the shiny app: web.tsd <- function() {   if (!requireNamespace("shiny", quietly = TRUE)) {     stop("shiny package is absent; Please install it first")   } getFromNamespace("runApp", ns="shiny")(appDir

Re: [R] please let me unsubscribe or remove me from mailing list.

2017-09-12 Thread Marc Girondot via R-help
Le 12/09/2017 à 16:57, Where's YK a écrit : Thank you. from cabi...@gmail.com Google R-help@r-project.org unsubscribe bring you to: https://www.r-project.org/mail.html Sincerely Marc __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and

Re: [R] Rounding of problem with sum command in R

2017-08-23 Thread Marc Girondot via R-help
Le 22/08/2017 à 16:26, niharika singhal a écrit : Hello I have a vector v=c(0.0886,0.1744455,0.1379778,0.1209769,0.1573065,0.1134463,0.2074027) when i do sum(v) or 0.0886+0.1744455+0.1379778+0.1209769+0.1573065+0.1134463+0.2074027 i am getting output as 1 But if i add them manually i get

Re: [R] How to concatenate in R

2017-08-02 Thread Marc Girondot
and paste the content on a virgin sheet. If you need this code because it is homework, you should first try yourself and propose some code that produces error or unwanted results. We are not here to do your homework. Sincerely Marc -- _

Re: [R] Remove attribute from netcdf4 object

2017-08-02 Thread Marc Girondot
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] [FORGED] Re: axis() after image.plot() does not work except if points() is inserted between

2017-07-31 Thread Marc Girondot via R-help
Le 28/07/2017 à 05:32, Paul Murrell a écrit : plot(1:10) mtext("margin-label", side=2, at=9, las=1, line=1, adj=0) par(mfg=c(1,1)) ## Only the text within the plot region is drawn mtext("margin-label", side=2, at=9, las=1, line=1, adj=0, col="red") It works also for axis(). Thanks a lot. Marc

Re: [R] axis() after image.plot() does not work except if points() is inserted between

2017-07-26 Thread Marc Girondot via R-help
els=0:2, cex.axis=0.5) axis(2, at=seq(from=0, to=1, length=ncol(D)), labels=0:3, las=1, cex.axis=0.5) # check that par("plt") is correctly setup par()$plt ### [1] 0.08844944 0.86408989 0.14253275 0.88541485 I think that it will remain a mystery ! At least the trick with points() is wo

Re: [R] axis() after image.plot() does not work except if points() is inserted between

2017-07-24 Thread Marc Girondot via R-help
h=nrow(D)), labels=0:2, cex.axis=0.5) axis(2, at=seq(from=0, to=1, length=ncol(D)), labels=0:3, las=1, cex.axis=0.5) identical(p1, p2) Le 24/07/2017 à 05:17, Jim Lemon a écrit : Hi marc, Try: par("usr") before and after the call to points and see if it changes. Jim On Sa

[R] axis() after image.plot() does not work except if points() is inserted between

2017-07-21 Thread Marc Girondot via R-help
It is known (several discussions on internet) that axis() cannot be used after fields:::image.plot() (axis() shows nothing). However, if points(1.5, 1.5, type="p") is inserted before the axis() finctions, it works. I have investigated what points(1.5, 1.5, type="p") is doing to allow axis

[R] optim() has a non-consistent way to send parameter for different methods

2017-06-23 Thread Marc Girondot via R-help
When optim() is used with method="BFGS", the name of parameters within the vector are transmitted (see below, first example). When method="Brent", the name of parameter (only one parameter can be fitted with Brent method) is not transmitted. As there is only one, of course, we know which

Re: [R] stepAIC() that can use new extractAIC() function implementing AICc

2017-06-08 Thread Marc Girondot via R-help
I have found the problem and a solution. The problem comes from the functions addterm.glm() and dropterm.glm() from MASS package. They use extractAIC() without transmitting the ... argument: aic <- aic + (extractAIC(object, k = k)[2L] - aic[1L]) I replace the call with: aic <- aic +

[R] stepAIC() that can use new extractAIC() function implementing AICc

2017-06-07 Thread Marc Girondot via R-help
I would like test AICc as a criteria for model selection for a glm using stepAIC() from MASS package. Based on various information available in WEB, stepAIC() use extractAIC() to get the criteria used for model selection. I have created a new extractAIC() function (and extractAIC.glm() and

[R] glm and stepAIC selects too many effects

2017-06-06 Thread Marc Girondot via R-help
This is a question at the border between stats and r. When I do a glm with many potential effects, and select a model using stepAIC, many independent variables are selected even if there are no relationship between dependent variable and the effects (all are random numbers). Do someone has

[R] optimx and follow.on=TRUE... does not follow

2017-05-17 Thread Marc Girondot via R-help
Hi, I would like to know if some of you have a solution for this problem: I use optimx (from package optimx) to fit the parameters of a model (complex model based on several imbricated exponential functions). I use the two methods : method = c("Nelder-Mead", "BFGS") with the options:

[R] Different output for "if else" and "ifelse" that I don't understand

2017-04-28 Thread Marc Girondot via R-help
Dear list-members, During the test phase of a function, I run it interactively (in Rstudio) and the ... produces an error. Then I use this to read it: if (class(try(list(...), silent=TRUE))=="try-error") p3p <- list() else p3p <- list(...) It works fine; interactively I will get > if

Re: [R] "found 4 marked UTF-8 strings" during check of package... but where !

2017-03-10 Thread Marc Girondot via R-help
I try to submit the package in CRAN (not in local --as-cran check). How I could "say" that these data have utf-8 characters inside? Thanks Marc Le 10/03/2017 à 15:24, Duncan Murdoch a écrit : On 10/03/2017 2:52 AM, Marc Girondot via R-help wrote: Dear members, I want submit to

[R] "found 4 marked UTF-8 strings" during check of package... but where !

2017-03-10 Thread Marc Girondot via R-help
Dear members, I want submit to CRAN a new version of a package that I maintain. When I check locally "as-cran" no note or error are reported but the link after submission reports several notes and one warning: For example: using R Under development (unstable) (2017-03-05 r72309) using

Re: [R] roxygen2 v6.0.0

2017-02-06 Thread Marc Girondot via R-help
com> Web: http://yihui.name On Mon, Feb 6, 2017 at 9:46 AM, Marc Girondot via R-help <r-help@r-project.org> wrote: Hi, I used roxygen2 v5.0.1 to document my package, and all was ok. I have just updated to roxygen2 v6.0.0 and my script is broken and I can't find why. I have done a si

[R] roxygen2 v6.0.0

2017-02-06 Thread Marc Girondot via R-help
ourse it fails after. Are you aware of this situation ? And do you have a solution ? Thanks a lot Marc A file DESCRIPTION: Package: essai Type: Package Title: Package Used For Try Version: 1.0 Date: 2017-02-06 Author: Marc Girondot <marc.giron...@u-psud.fr> Maintainer: Marc Girondot &l

Re: [R] Function that works within a package and not when copied in global environment. Why?

2017-02-02 Thread Marc Girondot via R-help
IFY = SIMPLIFY, USE.NAMES = USE.NAMES)) } Both are defined in the global env, but the first one works and not the second one. I am surprised and don't understand how it is possible. Sincerely Marc Girondot 2. You need to review how namespaces work. From the "Writing R extensions&

[R] Function that works within a package and not when copied in global environment. Why?

2017-02-02 Thread Marc Girondot via R-help
rize.args : objet 'vectorize.args' introuvable It fails because vectorize.args is unknown Indeed smartsub2 is different from smartsub. > identical(smartsub, smartsub2) [1] FALSE 1/ Why are they different? They are just a copy of each other. 2/ Second question, vectorize.args is indeed not defined before to

Re: [R] g parameter for deltaMethod() as a function

2017-01-31 Thread Marc Girondot via R-help
Dear John and list members, I have found a solution using the package nlWaldTest. I post the solution in case someone else will have this problem. Here is a summary of the problem: I would like use the delta method for a function for which no derivative using D() can be calculated. I would

Re: [R] g parameter for deltaMethod() as a function

2017-01-30 Thread Marc Girondot via R-help
Le 30/01/2017 � 19:04, Fox, John a �crit : >> Hi everyone, >> >> I try to use the Default S3 method DeltaMethod() from car package, but I >> have some problems when I try to use a function as the "g" parameter. I >> don't know if it is possible anyway. I hope that you could tell me: > I don't see

[R] g parameter for deltaMethod() as a function

2017-01-30 Thread Marc Girondot via R-help
Hi everyone, I try to use the Default S3 method DeltaMethod() from car package, but I have some problems when I try to use a function as the "g" parameter. I don't know if it is possible anyway. I hope that you could tell me: Here an example from the help of deltaMethod(). It works and I

Re: [R] \n and italic() in legend()

2016-12-29 Thread Marc Girondot via R-help
n(atop(italic("p")*"-value","based on "*italic("t")*"-test")) legend("topright", legend=v1, y.intersp = 3, bty="n") Regards Duncan Duncan Mackay Department of Agronomy and Soil Science University of New England Armidale NSW 23

[R] \n and italic() in legend()

2016-12-29 Thread Marc Girondot via R-help
Hi everyone, Could someone help me to get both \n (return) and italic() in a legend. Here is a little example showing what I would like (but without the italic) and second what I get: plot(1, 1) v1 <- "p-value\nbased on t-test" legend("topright", legend=v1, y.intersp = 3, bty="n") plot(1,

[R] MC_CORES and mc.cores for parallel package

2016-12-07 Thread Marc Girondot via R-help
Hi, From the documentation of ?options Options set in package parallel These will be set when package parallel (or its namespace) is loaded if not already set. mc.cores: a integer giving the maximum allowed number of additional R processes allowed to be run in parallel to the current R

Re: [R] Limit the y-axis line with ggplot2 (not the axis itself, but the line used at the left of the graph) [SOLVED]

2016-10-25 Thread Marc Girondot
uot;panel") # And draw both g <- ggplotGrob(p) g <- gtable_add_rows(x = g, heights = unit(2, "cm"), pos = 0) g <- gtable_add_grob(g, gl, t = 2, l=4, b=1, r=4) grid.newpage() grid.draw(g) Le 24/10/2016 à 13:08, Marc Girondot via R-help a écrit : Hello everybody, Using g

[R] Limit the y-axis line with ggplot2 (not the axis itself, but the line used at the left of the graph)

2016-10-24 Thread Marc Girondot via R-help
Hello everybody, Using ggplot2 package, is there a way to force to stop the y-axis line at a specified point ? (not using ylim because I want that some text written using annotate() at the top of the graph is still shown). Bellow is a simple example to show what I would like do: Thanks a

[R] ggplot() and annotation_custom()

2016-10-15 Thread Marc Girondot via R-help
Until now I was using plot() and I check the possibility to shift to ggplot2. All is OK until now except to write text out of the plotting region [equivalent of par(xpd=TRUE); text(x, y, labels)]. I have found using google recommendation to use annotation_custom() but I still failed to

[R] bquote in list to be used with do.plot()

2016-10-08 Thread Marc Girondot via R-help
Dear members, Has someone have a solution to include a bquote() statement in a list to be used with do.call() ? Here is an exemple: scaleY <- 1 plot(x=1, y=1, ylab=bquote(.(format(scaleY), scientific=FALSE)^"-1")) Like that, it works. Now he same in a list: L <- list(x=1,

Re: [R] Problem Mixstock in R

2016-09-21 Thread Marc Girondot via R-help
Le 19/09/2016 à 10:53, FIORAVANTI TATIANA a écrit : Dear members of the R-project I am doing a mixed stock analysis with the Mixstock Package in R, at the end of the analysis I would summarize all my results (mean, standard deviation, median, percentile, etc...) using the mysum(x, name=NULL)

Re: [R] R Shiny convert into Java

2016-08-19 Thread Marc Girondot via R-help
You should try these: http://www.renjin.org https://github.com/allr/purdue-fastr which are two R interpreters in Java. But I am not sure that shiny can work on these. Sincerely Marc Le 16/08/2016 à 15:11, Venky a écrit : Hi, How to run Shiny (Server,UI) into JAVA? I am running R Shiny

Re: [R] about netcdf files

2016-08-02 Thread Marc Girondot via R-help
You can find many tutorials in internet. For example, I did one here: http://max2.ese.u-psud.fr/epc/conservation/Girondot/Publications/Blog_r/Entrees/2014/4/27_Comparison_between_packages_RnetCDF%2C_ncdf4_and_ncdf.html Without any reproducibl example, it is impossible to help you further.

Re: [R] dependent p.values

2016-07-10 Thread Marc Girondot
without context: why p.values are dependent ? Do they come from the same dataset ? Or are they linked by an external source ? For both these situations, combining dependent p.values seems strange for me. When you will ask question in stackexchange, be more precise. Sincerely, Marc Girondot

Re: [R] error.crosses

2016-05-07 Thread Marc Girondot via R-help
- data.frame(A=rnorm(10, 10, 2), B=rnorm(10, 9, 3), C=sample(c("G", "H"), 10, replace=TRUE)) > d <- describeBy(df[, c("A", "B")], group=df$C) > error.crosses(d$G, d$H) Sincerely Marc Girondot Le 27/04/2016 20:54, Marlin Keith Cox a écrit : Hell

Re: [R] R logo size in package information

2016-03-30 Thread Marc Girondot via R-help
Le 30/03/2016 06:18, Jeff Newmiller a écrit : You are not clarifying yet. If this requires RStudio to reproduce then this question doesn't belong here. I am not yet convinced that RStudio IS required, but every time you mention it the water gets muddier. I try to be shorter: There is bad

Re: [R] R logo size in package information tab of Rstudio

2016-03-29 Thread Marc Girondot via R-help
svg, or Rlogo.svg is correctly scaled during R install. Here is a Rlogo.svg correctly scaled to replace the original version: http://www.ese.u-psud.fr/epc/conservation/CRAN/Rlogo.svg Sincerely, Marc Le 30/03/2016 00:44, Duncan Murdoch a écrit : On 29/03/2016 3:42 PM, Marc Girondot via R-h

[R] R logo size in package information tab of Rstudio

2016-03-29 Thread Marc Girondot via R-help
Two different sizes of R logo are shown in Rstudio in the Help at the package level. For example, numderiv shows a nice discreet logo located at (in MacosX): /Library/Frameworks/R.framework/Versions/3.3/Resources/doc/html/logo.jpg whereas packrat shows a huge logo located at:

Re: [R] help in maximum likelihood estimation

2016-03-29 Thread Marc Girondot via R-help
Le 28/03/2016 22:19, heba eldeeb via R-help a écrit : Dear AllI'm trying to find the maximum likelihood estimator of a certain distribution using nlm command but I receive an error as: non-finite value supplied by 'nlm' can't figure out what is wrong in my function Any help? Thank you in

Re: [R] axis break in R

2016-02-28 Thread Marc Girondot
Hi Eike, I didn't know how to do, so it was a nice exercise. Here is a solution using plot(). I have made a function plot.break(); the name of parameters of the function are self-explained (I think), but tell me if you need more explanation. You can add any parameters of the plot() function.

Re: [R] reading in multiple data sets in 2 loops

2016-02-07 Thread Marc Girondot
Try this: # install package HelpersMG from CRAN including dependencies install.packages("HelpersMG") # Update to the lastest version install.packages("http://www.ese.u-psud.fr/epc/conservation/CRAN/HelpersMG.tar.gz;, repos=NULL, type="source") # Use the function read_folder()

[R] Use predict() after lmer() (library lme4)

2016-02-02 Thread Marc Girondot
Bonjour, (don't worry, after I will write in English [at least I will try ;) ]) I try to understand better mixed models and then I have generated data and I try to understand how the fixed and the random effects are used in predict(). I understand when the random effect is of the form (1 |

Re: [R] Error not reported while checking package as cran

2015-06-29 Thread Marc Girondot
to install a more recent one. Henrik On Jun 29, 2015 1:49 AM, Marc Girondot marc_...@yahoo.fr mailto:marc_...@yahoo.fr wrote: Dear members, I have submitted to CRAN a new version of a package yesterday after checking it as cran with the lastest 3.2.1 R version and no error

[R] Error not reported while checking package as cran

2015-06-29 Thread Marc Girondot
Dear members, I have submitted to CRAN a new version of a package yesterday after checking it as cran with the lastest 3.2.1 R version and no error was reported. The command I used was: R CMD check 'xxx/HelpersMG' --as-cran However, I received reports from CRAN maintainers that I should add

[R] gdata library 2.16.1

2015-05-04 Thread Marc Girondot
Dear list-members, Since I update gdata library to 2.16.1 version this morning, I have an error on the two macs I use (details on system and R versions at the end). When I load the package, I have this error: library(gdata,

[R] How get list element name in R 3.2.0

2015-04-26 Thread Marc Girondot
I don't see if this difference is noted is the list of changes: http://cran.r-project.org/doc/manuals/r-devel/NEWS.html If it is not a bug but a feature, what is the new way to get the list element name within a lapply or mclappy function. Thanks a lot Marc Girondot

Re: [R] HELP asin transformation

2015-02-24 Thread Marc Girondot
Le 22/02/2015 19:28, CHIRIBOGA Xavier a écrit : Dear all, I attempted to transform my data using asin but a WARNING message appears: dat1$Abu.tr-asin(sqrt(dat1$Abundance/100)) Warning message: In asin(sqrt(dat1$Abundance/100)) : NaNs produced What does it mean? Is it a problem? How can

  1   2   >