Re: [R] Data frame organization

2019-08-27 Thread Arnaud Mosnier
ble(text="A 10 > B 5 > C 9 > A 5 > B 15 > C 20") > library(prettyR) > stretch_df(amdf,"V1","V2") > V1 V2_1 V2_2 > 1 A 105 > 2 B5 15 > 3 C9 20 > > Jim > > On Tue, Aug 27, 2019 at 4:06 A

[R] Data frame organization

2019-08-26 Thread Arnaud Mosnier
Hi, I have a really simple question. I need to convert a data.frame with the following format A 10 B 5 C 9 A 5 B 15 C 20 in this format A 10 5 B 515 C 920 Thanks !!! [[alternative HTML version deleted]] __ R-help

[R] file connection when using parallel

2016-05-24 Thread Arnaud Mosnier
Dear UserRs, I have a little problem creating a file connection when working in parallel (see the reproducable script below). I am sure this is something obvious, Can you enlighten me ? Thanks, Arnaud # This part works # cat("This is a test file" , file={f <- tempfile()}) con

[R] Clean method to convert date and time between time zones keeping it in POSIXct format

2016-05-09 Thread Arnaud Mosnier
Dear UseRs, I know two ways to convert dates and time from on time zone to another but I am pretty sure that there is a better (cleaner) way to do that. Here are the methods I know: ## The longest way ... T1 <- as.POSIXct("2016-05-09 10:00:00", format="%Y-%m-%d %H:%M:%S", tz="America/New_York

Re: [R] Reading some csv files from different folders and add the name of each files to the first column of files

2015-07-26 Thread Arnaud Mosnier
Hi Lida, You can try this: d<- choose.dir() # choose the folder with the subdirectories containing the csv files f <- list.files(d, full.names = TRUE, recursive = TRUE) # Here the example for the "sing" files selsing <- grep("sing",f) #Select the files notaining the word sing allsing <- data.fr

[R] Comparing gam models fitted using ti()

2015-02-16 Thread Arnaud Mosnier
Dear R-Help list, I want to compare gam models including interaction with simpler models. For interaction models, I used gam(Y~ti(X1) + ti(X2) + ti(X1,X2)) removing the interaction, the models end as Y~ti(X1) + ti(X2) How those models compare with models with the form Y ~ s(X1) + s(X2) In my cas

Re: [R] Submodel selection using dredge and gam (mgcv)

2014-11-12 Thread Arnaud Mosnier
Argh ! Ok ... my fault ... the use of back-ticks was the solution !!! Thanks, Arnaud 2014-11-12 14:19 GMT-05:00 Kamil Bartoń : > Hi Arnaud, > please read ?dredge -> "Details" -> "Subsetting", where this is explained. > > > On 2014-11-12 15:19, Arnaud M

Re: [R] Submodel selection using dredge and gam (mgcv)

2014-11-12 Thread Arnaud Mosnier
; See also: > help("Logic", "base") > fortunes::fortune(350) > > best, > kamil > > > > On 2014-11-10 21:26, Arnaud Mosnier wrote: > >> Hi, >> >> I want to use dredge to test several gam submodels including interactions. >>

[R] Submodel selection using dredge and gam (mgcv)

2014-11-10 Thread Arnaud Mosnier
Hi, I want to use dredge to test several gam submodels including interactions. I tried to find a way in order to keep models with interaction only if the single variables occurring in the interaction are also included. i.e.: for y~s(x0)+s(x1)+ti(x0, x1) I want to keep y ~ s(x0) y ~ s(x1) y ~ s(

Re: [R] speed of makeCluster (package parallel)

2013-10-29 Thread Arnaud Mosnier
: [R] speed of makeCluster (package parallel) Message-ID: <526ea5ee.9060...@stats.ox.ac.uk> Content-Type: text/plain; charset=ISO-8859-1; format=flowed On 28/10/2013 16:19, Arnaud Mosnier wrote: > Hi all, > > I am quite new in the world of parallelization and I wonder if there is a &g

Re: [R] speed of makeCluster (package parallel)

2013-10-28 Thread Arnaud Mosnier
ach problem is > different. Some problems are even not scalable. > > Simon > > > On 28 Oct 2013, at 17:51, Arnaud Mosnier wrote: > > > Thanks Simon, > > > > I already read the parallel vignette but I did not found what I wanted. > > May be you can be mo

Re: [R] speed of makeCluster (package parallel)

2013-10-28 Thread Arnaud Mosnier
Thanks Simon, I already read the parallel vignette but I did not found what I wanted. May be you can be more specific on a part of the document that can provide me hints ! Arnaud 2013/10/28 Simon Zehnder > See library(help = "parallel”) > > > On 28 Oct 2013, at 17:19, Arna

[R] speed of makeCluster (package parallel)

2013-10-28 Thread Arnaud Mosnier
Hi all, I am quite new in the world of parallelization and I wonder if there is a way to increase the speed of creation of a parallel socket cluster. The time spend to include threads increase exponentially with the number of thread considered and I use of computer with two 8 cores CPU and thus sh

Re: [R] lowercase and uppercase greek letters

2013-09-18 Thread Arnaud Mosnier
Thanks Murdoch. I tried PHI but not Phi. Arnaud 2013/9/17 Duncan Murdoch > On 17/09/2013 3:26 PM, Arnaud Mosnier wrote: > >> Hi all, >> >> I want to present a figure including the uppercase and lowercase version >> of >> the greek letter phi. >> >

Re: [R] lowercase and uppercase greek letters

2013-09-18 Thread Arnaud Mosnier
You're right! QFMFT! :-) Thanks 2013/9/17 Rolf Turner > On 09/18/13 07:26, Arnaud Mosnier wrote: > >> Hi all, >> >> I want to present a figure including the uppercase and lowercase version >> of >> the greek letter phi. >> >> I know t

[R] lowercase and uppercase greek letters

2013-09-17 Thread Arnaud Mosnier
Hi all, I want to present a figure including the uppercase and lowercase version of the greek letter phi. I know that I can use "expression" to have the symbol like in: plot(1~1, main = expression(phi)) But, is there somewhere things like upper(phi) or lower(phi) ? Thanks for your help ! Arna

Re: [R] column width in .dbf files using write.dbf ... to be continued

2013-05-22 Thread Arnaud Mosnier
Thanks Bastien, I completely forgot that I asked this question. I learned a lot since then ... actually, now I know how to do it, but it was not the case in 2009 :-) Arnaud 2013/5/22 > > Hello Arnaud, > > You posted this question a long long time ago, however I found your answer > so I decided

Re: [R] Pairwise deletion in a linear regression and in a GLM ?

2012-12-13 Thread Arnaud Mosnier
relations pairwise, > and then you use the function mat.regress using the pairwise matrix. > > Hope this helps,**** > > ** ** > > José > > ** ** > > ** ** > > *From:* Arnaud Mosnier [mailto:a.mosn...@gmail.com] > *Sent:* 13 December 2012 16:13 > *To:* J

Re: [R] Pairwise deletion in a linear regression and in a GLM ?

2012-12-13 Thread Arnaud Mosnier
ds, > > José > > > José Iparraguirre > Chief Economist > Age UK > > > > > -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] > On Behalf Of Arnaud Mosnier > Sent: 13 December 2012 15:40 > To: r-help@r-proje

[R] Pairwise deletion in a linear regression and in a GLM ?

2012-12-13 Thread Arnaud Mosnier
Dear useRs, In a thesis, I found a mention of the use of pairwise deletion in linear regression and GLM (binomial family). The author said that he has used R to do the statistics, but I did not find the option allowing pairwise deletion in both lm and glm functions. Is there somewhere a package al

Re: [R] increase the usage of CPU and Memory

2012-06-27 Thread Arnaud Mosnier
Hi Xi, Maybe you should try to "parallelize" your calculations. See package "parallel". http://stat.ethz.ch/R-manual/R-devel/library/parallel/doc/parallel.pdf Arnaud On Mon, Jun 25, 2012 at 8:07 PM, Xi wrote: > Dear All, > > I have been searching online for help increasing my R code more effici

Re: [R] Define lower-upper bound for parameters in Optim using Nelder-Mead method

2012-05-02 Thread Arnaud Mosnier
Thanks for this good idea ! Arnaud 2012/5/1 Ted Harding > On 01-May-2012 19:58:41 Arnaud Mosnier wrote: > > Dear UseRs, > > > > Is there a way to define the lower-upper bounds for parameters > > fitted by optim using the Nelder-Mead method ? > > > >

[R] Define lower-upper bound for parameters in Optim using Nelder-Mead method

2012-05-01 Thread Arnaud Mosnier
Dear UseRs, Is there a way to define the lower-upper bounds for parameters fitted by optim using the Nelder-Mead method ? Thanks, Arnaud [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/li

Re: [R] Use of optim to fit two curves at the same time ?

2012-04-26 Thread Arnaud Mosnier
I second the proposition ! Thanks to let me discover that absolutely essential library !! :-) Arnaud Le 26 avril 2012 15:30, Marc Schwartz a écrit : > > On Apr 26, 2012, at 12:49 PM, Greg Snow wrote: > > > The phrase "does not work" is not very helpful, it can mean quit a few > > things includi

Re: [R] Use of optim to fit two curves at the same time ?

2012-04-26 Thread Arnaud Mosnier
ction(x){optfunc3(x,dfxy,dfxy2)})) > > and see if it "works". Run the last line a couple more times to see > how well it works (at least it worked for me, if this does not work > for you, tell us what "does not work" means). > > On Wed, Apr 25, 2012 at 6:57 AM,

Re: [R] Use of optim to fit two curves at the same time ?

2012-04-25 Thread Arnaud Mosnier
Dear list, In order to find a solution to my problem, I created a third objective function including both calculations done in the previous cases. This function return a value (i.e. the value to be minimize by optim) equal to the sum of the two sum of squares, but it does not work (see the code ad

[R] Use of optim to fit two curves at the same time ?

2012-04-24 Thread Arnaud Mosnier
Dear list, Here is a small example code that use optim and optimize in order to fit two functions. Is it possible to fit two functions (like those two for example) at the same time using optim ... or another function in R ? Thanks Arnaud #

Re: [R] GAM (mgcv) warning: matrix not positive definite

2012-02-06 Thread Arnaud Mosnier
e suppresses the warning. > > best, > Simon > > > On 03/02/12 20:38, Arnaud Mosnier wrote: > >> Dear list, >> >> >> I fitted the same GAM model using directly the function gam(mgcv) ... >> then as a parameter of another function that capture the war

[R] GAM (mgcv) warning: matrix not positive definite

2012-02-03 Thread Arnaud Mosnier
Dear list, I fitted the same GAM model using directly the function gam(mgcv) ... then as a parameter of another function that capture the warnings messages (see below). In the first case, there is no warning message printed, but in the last one, the function find two warning messages stating "mat

[R] Model selection and model efficiency - Search for opinions

2011-08-24 Thread Arnaud Mosnier
Hi, In order to find the best models I use AIC, more specifically I calculate Akaike weights then Evidence Ratio (ER) and consider that models with a ER < 2 are equally likely. But the same problem remain each time I do that. I selected the best models from a set of them, but I don't know if those

Re: [R] How to find the likelihood of a null model in R

2011-07-26 Thread Arnaud Mosnier
Try the logLik function with your model ! Arnaud Date: Mon, 25 Jul 2011 12:16:37 +0100 From: Partha Pratim PATTNAIK To: r-help@R-project.org Subject: [R] How to find the likelihood of a null model in R Message-ID: <20110725121637.jo1u2ctuxy8kw...@www.sms.ed.ac.uk> Content-Type: text/plain;

[R] GLS models and variance explained

2011-06-22 Thread Arnaud Mosnier
Dear list, Inspecting residuals of my linear models, I detected spatial autocorrelation. In order to take this into account, I decided to use the GLS method with the correlation = corGaus ( ~ X + Y). Then, I can sort my GLS models based on their AIC. But ... how to know the proportion of the vari

Re: [R] Still have problems with tcltk in R 64 bit

2011-06-15 Thread Arnaud Mosnier
= "tcltk")) >    packageStartupMessage(" ", "done", domain = "R-tcltk") >    invisible() > } > > > This tells us that if you do not have "MY_TCLTK" defined on startup of R, > you probably forgot to select the tcltk files for 64

Re: [R] Still have problems with tcltk in R 64 bit

2011-06-15 Thread Arnaud Mosnier
. Where are the configuration files used to define the path to each tcl version ? Arnaud 2011/6/14 Uwe Ligges : > > > On 14.06.2011 22:01, Arnaud Mosnier wrote: >> >> I achieve to make tcltk work on R 64 installing Active tcltk8.5 64bit >> version then setting windows environm

Re: [R] Still have problems with tcltk in R 64 bit

2011-06-14 Thread Arnaud Mosnier
I achieve to make tcltk work on R 64 installing Active tcltk8.5 64bit version then setting windows environment variables as in http://www.sciviews.org/_rgui/tcltk/InstallRTclTk.html. But now, it uses only this 64 bit version and thus do not work anymore in R 32 bit ! In my case, it solves my probl

[R] Still have problems with tcltk in R 64 bit

2011-06-14 Thread Arnaud Mosnier
Dear R users, Since a long time now, I have the following error when I want to load the tcltk library in R 64 bit. Loading Tcl/Tk interface ...Error : .onLoad failed in loadNamespace() for 'tcltk', details: call: inDL(x, as.logical(local), as.logical(now), ...) error: unable to load shared

[R] Problems with tcltk

2011-05-11 Thread Arnaud Mosnier
Dear R-helpers, I am using R x64 and when I want to load the tcltk library, it gives me the following error: Loading Tcl/Tk interface ...Error : .onLoad failed in loadNamespace() for 'tcltk', details: call: inDL(x, as.logical(local), as.logical(now), ...) error: unable to load shared object '

[R] Problem with tcltk

2011-03-04 Thread Arnaud Mosnier
Dear all, Since I installed the x64 version of R (v2.12.1), I got a problem with tcltk that I did not achieve to resolve. When loading the library, it gives me the following error message: Loading Tcl/Tk interface ...Error : .onLoad failed in loadNamespace() for 'tcltk', details: call: inDL(x,

[R] Bug in the function Variogram (package nlme) ?

2011-02-18 Thread Arnaud Mosnier
Dears UseRs, In Zuur's book (Mixed effects models and extensions in ecology with R), p 167, it is mentionned that the Variogram function (package nlme) scale the sill to 1. Here is the plot of the semi-variogram given by the Variogram function on my "lme" object. (http://imm.io/3OLe) Note that the

[R] Variogram (nlme) of a lme object - corSpatial element question

2011-02-18 Thread Arnaud Mosnier
Dear Users, >From previous analysis (semi-variograms using package gstat), I found spatial autocorrelation in my dataset. The best fitted model to this spatial correlation structure is the Gaussian model (Spherical, Exponential, Linear tested and comparison done by Sum of Square errors). So I used

[R] Potential problem with subset !!!

2010-02-12 Thread Arnaud Mosnier
Dear useRs, Just a little post to provide the answer of a problem that took me some time to resolve ! Hope that reading this will permit the others to avoid that error. When using the subset function, writing subset (data, data$columnname == X) or subset (data, columnname == X) do the same thin

[R] Column width in dbf file ... again ...

2010-02-10 Thread Arnaud Mosnier
Hello, First please excuse me for reposting the same question I sent a few weeks ago, but I did not have any answer ! I am trying to "manually" choose the width (i.e. number of character allowed) of columns containing text when creating dbf. files using write.dbf (library foreign). In particular,

[R] Create a function with multiple object as an output

2010-02-10 Thread Arnaud Mosnier
Dear useRs, I want to make a function that return several object (from a loop). I know, I can put them in a list, then the function return the list, but is it possible that it returns several independent object. I used the assign function to create several object, it works when I use it outside t

[R] Write.dbf ... problem

2010-01-20 Thread Arnaud Mosnier
Hello, I am trying to "manually" choose the width (i.e. number of character allowed) of columns containing text when creating dbf. files using write.dbf (library foreign). In particular, I want to define this width when the column have to contain text but is empty. By default, write.dbf give a wa

Re: [R] How can I store the results

2010-01-14 Thread Arnaud Mosnier
If you absolutely need a single file for each iteration, you can also include the iteration number into your output filename. for(i in 1:dim(your input data)[1]) { results<- your calculation write.csv(results, paste("filename", "_", i, sep="")) } Arnaud Date: Wed, 13 Jan 2010 15:59:37 +0100 F

[R] column width in .dbf files using write.dbf ... to be continued

2010-01-13 Thread Arnaud Mosnier
Dear UseRs, I did not have any answer to my previous message ("Is there a way to define "manually" columns width when using write.dbf function from the library foreign ?"), so I tried to modify write.dbf function to do what I want. Here is my modified version : write.dbfMODIF <- function (datafr

[R] column width in .dbf files using write.dbf

2010-01-06 Thread Arnaud Mosnier
Dear useRs, Is there a way to define "manually" columns width when using write.dbf function from the library foreign ? Thanks, Arnaud R version 2.10.0 (2009-10-26) i386-pc-mingw32 [[alternative HTML version deleted]] __ R-help@r-project.org

[R] Strange characters that block import

2009-10-14 Thread arnaud Mosnier
Dear useRs, I try to import a text file that contain some strange characters coming from the misinterpretation of foreign language characters by another software (see below). Here is an example of text with a line containing characters that bug the import