Re: [R] Unexpected date format coercion

2021-07-01 Thread Jeremie Juste
Hello On Thursday, 1 Jul 2021 at 08:25, PIKAL Petr wrote: > Hm. > > Seems to me, that both your codes are wrong but printing in Linux is > different from Windows. > > With > as.Date("20-12-2020","%Y-%m-%d") > you say that 20 is year (actually year 20) and 2020 is day and only first > two values

[R] Unexpected date format coercion

2021-07-01 Thread Jeremie Juste
Hello, I have been surprised when converting a character string to a date with the following format, in R 4.1.0 (linux debian 10) as.Date("20-12-2020","%Y-%m-%d") [1] "20-12-20" in R 4.0.5 (window 10) as.Date("20-12-2020","%Y-%m-%d") [1] "0020-12-20" Here I was expecting a blunt and sharp N

Re: [R] most stable way to output text layout

2021-06-13 Thread Jeremie Juste
quot;tenth") > tabify(mat,mat_names) Many thanks for your suggestion, I haven't considered the horizontal spacing before. The columns names do help as well. Best regards, Jeremie > > Jim > > On Sun, Jun 13, 2021 at 2:25 AM Jeremie Juste wrote: >> >> Hello,

Re: [R] most stable way to output text layout

2021-06-12 Thread Jeremie Juste
Hello, Many thanks to you all for the prompt reply. Thanks for sharing. On Saturday, 12 Jun 2021 at 09:53, Jeff Newmiller wrote: > Can't say this appeals to me, but sprintf would make a difference: > > apply( > mat,1, > function(x) { > x[is.na(x)] <-"" > cat(paste(

[R] most stable way to output text layout

2021-06-12 Thread Jeremie Juste
console using the following command apply( mat,1, function(x) { x[is.na(x)] <-"" cat(x,"\n") }) Do you have any suggestion for how can I have better control on the print layout of the matrix so that I can fix the width of each cell?

Re: [R] setRefClass in package

2021-03-24 Thread Jeremie Juste
Hello, Many thanks for the reply. Indeed there was no scoping issue here. I was sloppy. Best regards, Jeremie On Wednesday, 24 Mar 2021 at 11:34, Duncan Murdoch wrote: > On 24/03/2021 9:06 a.m., Jeremie Juste wrote: >> Hello, >> I was wondering how to call a function outside a

[R] setRefClass in package

2021-03-24 Thread Jeremie Juste
Hello, I was wondering how to call a function outside a setRefClass but inside the package without export it. Let me explain by means of an example. - in the file test-package/R/test.R ##' some description ##' ##' some details ##' @title test ##' @return sideeffect

Re: [R] readline in function call with space in prompt.

2021-02-17 Thread Jeremie Juste
ion: 18.10.3snapshot [elpa: 20201122.814] (loaded from c:/Users/Jeremie/AppData/Roaming/.emacs.d/elpa/ess-20201122.814/) I will report it on the ESS mailing list if need be. Many thanks again, Best regards, -- Jeremie Juste __ R-help@r-project.or

[R] readline in function call with space in prompt.

2021-02-08 Thread Jeremie Juste
ction: ") > selection: abc[Ret] > a > "abc" It is the expected behavior or am I missing something? Best regards, Jeremie -- Jeremie Juste > R version 4.0.3 (2020-10-10) __ R-help@r-project.org mailing list -- To UNSUBSCRIBE a

Re: [R] seq.Date when date is the last date of the month

2021-01-07 Thread Jeremie Juste
ot;), length=24, by="1 month") - 1 > > See this old StackOverflow answer where I used this before: > > > https://stackoverflow.com/questions/8333838/generate-a-sequence-of-the-last-day-of-the-month-over-two-years > > Dirk -- Jeremie Juste _

Re: [R] seq.Date when date is the last date of the month

2021-01-07 Thread Jeremie Juste
Hello Jim, Many thanks for the feedback > Using "month" first advances the month without changing the day: if > this results in an invalid day of the month, it is counted forward > into the next month: see the examples. Indeed I missed the documentation of seq.Date that refers to seq.POSIXt. Ma

[R] seq.Date when date is the last date of the month

2021-01-07 Thread Jeremie Juste
12-08-31" "2012-10-01" When the same command is performed for the start of the month. I get a result I expect. > seq(as.Date("2012-08-01"),by="1 month",length=2) [1] "2012-08-01" Is there an explanation for this behavior? Best regards, -- Jeremie Juste __

Re: [R] Help with connection issue for R (just joined, leading R for our agency)

2020-12-11 Thread Jeremie Juste
Hello Alejandra, || On Tuesday, 8 Dec 2020 at 10:48, Alejandra Barrio Gorski wrote: Welcome to the mailing list. > Greetings, I am new to this list. I joined because I am pioneering the use > of R for the agency I work for. I essentially work alone and would like to > reach out for help on an

Re: [R] Aide pour finaliser ce code

2020-10-09 Thread Jeremie Juste
d the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Best regards, Jeremie Juste On Friday, 9 Oct 2020 at 13:31, Ablaye Ngalaba wrote: > Hello. > Here is my R code. I used the functional data . Now I need

Re: [R] Question about the package "MatchIt"

2020-10-09 Thread Jeremie Juste
problem you are facing. PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Best regards, -- Jeremie Juste __ R-help@r-project.org mailing list -- To UNSUBSCRI

Re: [R] exiting mclapply early on error

2020-10-09 Thread Jeremie Juste
Hello Giovanni, I don't know if my workflow would suit you but I tend to want the opposite when I launch a parallel process. I tend to want to keep the processes alive as long as they can. If the computation time is long I would not want to lose everything. lapply..8 <- function(X,FUN,...){ m

Re: [R] help with nesting if else statements

2020-09-23 Thread Jeremie Juste
hen > assigning to type 'logical' (column 6 named 'PHENO') > > Please advise, > Ana > > On Wed, Sep 23, 2020 at 2:48 PM Jeremie Juste wrote: >> >> >> Hello Ana Marija, >> >> I cannot reproduce your error, >> >> with a

Re: [R] help with nesting if else statements

2020-09-23 Thread Jeremie Juste
Hello Ana Marija, I cannot reproduce your error, with a$PHENO=ifelse(a$PLASER==2 |a$RTNPTHY==2, 2, ifelse(a$CURRELIG==1 | a$RTNPTHY==1,1,NA)) For instance I have the expected PHENO=2 > FID IID CURRELIG PLASER RTNPTHY PHENO > 39: fam5706 G57061 1 2 2 In gen

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

2020-02-28 Thread Jeremie Juste
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 basically it will give you any file that contains r (but not that starts with r) so you got what you expected with > dir(pattern=".txt") just by ch

Re: [R] (no subject)

2018-12-03 Thread Jeremie Juste
Hello, Can you provide more information? What is your operating system? What is your database management system (sqlite, mySQL,...) What package do you use to import the data in R from the database? What is the default language on your computer? Are the variables not in farsi fine? My guess is th

Re: [R] High dimensional optimization in R

2018-12-01 Thread Jeremie Juste
Hello, Genetic algorithm can prove handy as well here. see for instance https://cran.r-project.org/web/packages/GA/vignettes/GA.html with non-convex objective functions I usually try a genetic algorithm for a few rounds then finish using nlminb Best regards, Jeremie Marc Girondot via R-help

Re: [R] source() fails in same directory as script: cannot find file

2018-10-26 Thread Jeremie Juste
Hello, I suspect the error is in the file input-summerize.R. I creating a new file input-summerize2.R with only print("hello") for instance and check if > setwd("~/documents/white-papers/geochemistry/willamette-river-mercury/scripts") > source("input-summerize2.R") works Hope it helps, Jerem

Re: [R] (no subject)

2018-10-20 Thread Jeremie Juste
,1] [,2] [,3] > [1,]    2    4    7 > [2,]    3    6    8 > > Le samedi 20 octobre 2018 à 15:21:53 UTC+2, Jeremie Juste > a écrit : > > malika yassa via R-help writes: > > Hello, > > Can you specify what you mean by deleting exactly? > Do you want to have

Re: [R] (no subject)

2018-10-20 Thread Jeremie Juste
malika yassa via R-help writes: Hello, Can you specify what you mean by deleting exactly? Do you want to have zero in the diagonal or do you want to extract the non-diagonal part? Besides your matrix is not a square matrix. Do you really want to extract the non-diagonal part of a non square mat

[R] modify the supposed return value of a function during evaluation?

2018-09-14 Thread Jeremie Juste
Hello, I'm wondering it is possible and if yes would it be desirable to modify the return value of functions during evaluation. I supposed this would be very useful during debugging myfun <- function(x) {res <- x+3 ; browser() ; res} let say I run the following function myfun(3) and drop in

Re: [R] ddply (or other suitable solution) question

2018-09-13 Thread Jeremie Juste
Andras Farkas via R-help writes: Hello, set.seed(123.456) df <-data.frame(ID=c(1,1,2,2,2,3,3,3,3,4,4,5,5), read=c(1,1,0,1,1,1,0,0,0,1,0,0,0), int=c(1,1,0,0,0,1,1,0,0,1,1,1,1), z=rnorm(13,1,5), y=rnorm(13,1,5)) May this will suffice? lapply(unique(df$ID),function(x) df[df$ID==x,]) HT

Re: [R] Multiple counters in a single for loop

2018-08-26 Thread Jeremie Juste
Duncan Murdoch writes: >> for ( i in 1:length(var1)){ > > This is generally a bad idea: if length(var1) == 0, it does the wrong > thing, since 1:0 is c(1L, 0L). Better to use > > for ( i in seq_along(var1) ) { > granted. One should check the validity of their variables before using them but I

Re: [R] Saving objects in RData file in different name

2018-07-28 Thread Jeremie Juste
Christofer Bogaso writes: Hello In case you have conflicting data issue when you load data, you can also do it the other way around. Indeed you never know when a possible conflict might occur in the future. The following line load the data in a new environment e first then get it back to your

Re: [R] how to locate specific line?

2018-07-27 Thread Jeremie Juste
Hello, If you need to go through R the function fread of data.table can speed up the data import. If not and you work on a gnu/linux distro may be awk might help https://stackoverflow.com/questions/5536018/how-to-print-matched-regex-pattern-using-awk HTH, Jeremie _

Re: [R] [bug] spdep package?

2018-07-23 Thread Jeremie Juste
#x27;spDataLarge', > repos='https://nowosad.github.io/drat/', type='source')) > >> loadedNamespaces() > [1] "compiler" "graphics" "utils" "grDevices" "stats" "datasets" > [7] "methods

Re: [R] [FORGED] [bug] spdep package?

2018-07-23 Thread Jeremie Juste
Hello, >This is *very* unlikely to be a bug. People should always exercise a >great deal of caution about conjecturing bugs when they encounter a >phenomenon that they don't understand. Ok, I over reacted and I should let the package maintainers qualify what is a bug or not. My point is that

Re: [R] [bug] spdep package?

2018-07-23 Thread Jeremie Juste
Helllo, Thanks for the info. I still think these variables should not be loaded when library(spdep) is called. But I'll handle it following your suggestion. Thanks, Jeremie > It turns out that that 'x' comes from the spData package and lives > inside that package (part of its namespace)

[R] [bug] spdep package?

2018-07-23 Thread Jeremie Juste
Hello, I found a dangerous issue in the library spdep. I get variables x and y that cannot be removed by rm() and I don't don't how they show up. Can anyone reproduce this? ~$ R --vanilla > rm(list=ls()) > library(spdep) > x [1] 0 30 60 90 120 150 180 210 240 270 300 330 360 390 420 450

[R] running Rmpi with SGE on a cluster

2018-07-01 Thread Jeremie Juste
Hello, I would like to know how to use Rmpi on a cluster but usually the workflow of the cluster uses sun grid engine to launch jobs. I found this reference on the web http://borisv.lk.net/howtos/grid-mpi-r-howto.html. But I could not even reproduce that example some errors with > n.cores <- m

Re: [R] Calculate focal values for neighboring cells that are located at the raster edge from the function "focal" in the R package "raster"

2018-06-09 Thread Jeremie Juste
Hello, >> I am using the function "focal" in the R package "raster" but I don’t >> understand how the function calculates values for neighboring cells that >> are located at the raster edge. Here is an example reproducible: focal is a method for the S4 object RasterLayer. You can have access to

Re: [R] sum multiple csv files

2018-01-15 Thread Jeremie Juste
Alejandra Lopez-Galan writes: Hello, I'm not sure to fully answer you question but I'll give it a try. I'll use the library "data.table" as I forgot how to do it in base R. If you don't have it you will have to install it by doing > install.packages(data.table,repos ="http://cran.us.r-project.or

Re: [R] [FORGED] Re: R vs PYTHON vs SAS vs SPSS?

2017-12-03 Thread Jeremie Juste
Rolf Turner writes: > On 01/12/17 20:33, Hasan Diwan wrote: > >> Yes. > > Very true. But some *thinking* is required; that often proves to be a > formidable stumbling block. Or one of the best decision you'll ever take. You cannot master SAS without expensive courses and information does not

[R] Problems installing mice package

2017-11-15 Thread Jeremie Juste
Hello, I tried intalling mice package and got the following error: * installing *source* package ‘mice’ ... ** package ‘mice’ successfully unpacked and MD5 sums checked ** libs g++ -I/usr/local/lib/R/include -DNDEBUG -I"/home/djj/R/x86_64-pc-linux-gnu-library/3.4/Rcpp/include" -I/usr/local/

[R] making-a-lisp implementation of R

2017-10-28 Thread Jeremie Juste
Hello, I was trying to make my R implementation of making-a-lisp https://github.com/kanaka/mal/tree/master/ And to my surprise I got stuck in the starting blocks. There is already a mal implementation of R here https://github.com/kanaka/mal/tree/master/r but it uses rdyncall package which is not

[R] Matrix logical operator

2017-07-16 Thread Jeremie Juste
Hello, I have some trouble understanding why !b &&TRUE is TRUE. Do you have an idea? > b <- matrix(c(0,1,1,0,1,0),2) > !b [,1] [,2] [,3] [1,] TRUE FALSE FALSE [2,] FALSE TRUE TRUE > !b &&TRUE [1] TRUE Best regards, Jeremie __ R-help@r-

[R] How to source a local R file to a remote session.

2017-03-27 Thread Jeremie Juste
Hello, I don't know exactly where to turn to. I'm using Emacs speak statistics and I can execute a codes on my local computer to a remote session seemlessly. But I've always wondered how to source a file on local computer to the remote session? Till now I have copied the files to the remote host

Re: [R] copula package error when gumbel parameter is close to bound.

2016-05-04 Thread Jeremie Juste
Hello > Berwin A Turlach writes: > That you don't have the package Rmpfr installed? And it seems to be > needed for the higher dimension. On my machine it works: > Thanks for the lead, Best regards, Jeremie __ R-help@r-project.org mailing list -