Re: [R] problems in vectors of dates_times

2017-04-06 Thread Ulrik Stervbo
Hi Troels, I get no error. I think we need more information to be of any help. Best wishes, Ulrik On Fri, 7 Apr 2017 at 08:17 Troels Ring wrote: > Dear friends - I have further problems handling dates_times, as > demonstrated below where concatenating two formatted vectors of > date_times res

[R] problems in vectors of dates_times

2017-04-06 Thread Troels Ring
Dear friends - I have further problems handling dates_times, as demonstrated below where concatenating two formatted vectors of date_times results in errors. I wonder why this happens and what was wrong in trying to take these two vectors together All best wishes Troels Ring Aalborg, Denmark W

[R] Add local image as inline embedded Image

2017-04-06 Thread Archit Soni
Hi All, I am using mailR package to send emails by attaching my local image files. However the image still refers to my file location and never truly embeds the image in the email. This came up in testing when my colleague was getting a red cross instead of an image. Any thoughts to resolve this

Re: [R] readr to generate tibble from a character matrix

2017-04-06 Thread David L Carlson
Ulrik's solution gives you factors. To get them as characters, add as.is=TRUE: > m %>% +as_tibble() %>% +lapply(type.convert, as.is=TRUE) %>% +as_tibble() # A tibble: 4 × 5 A B C D E 1 a e i 1 11.2 2 b f j 2 12.2 3 c

Re: [R] Is there a way to get R script line number

2017-04-06 Thread Bert Gunter
I believe the answer is: No. "Line number" is an ambiguous concept. Does it mean physical line on a display of a given width? a line of code demarcated by e.g. ; a step in the execution of script (that might display over several physical lines?) However, various IDE's have and display "line numbe

[R] Is there a way to get R script line number

2017-04-06 Thread Brad P
Hello, Is there a way to get the current line number in an R script? As a silly example, if I have the following script and a function called getLineNumber (suppose one exists!), then the result would be 3. 1 # This is start of script 2 3 print( getLineNumber() ) 4 5 # End of script Thanks for

Re: [R] readr to generate tibble from a character matrix

2017-04-06 Thread Ben Tupper
Hi, Thanks for this solution! Very slick! I see what you mean about the two calls to as_tibble(). I suppose I could do the following, but I doubt it is a gain... mm <- lapply(colnames(m), function(nm, m) type.convert(m[,nm], as.is = TRUE), m=m) names(mm) <- colnames(m) as_tibble(mm) # # A t

Re: [R] average at specific hour "endpoints" of the day

2017-04-06 Thread Jeff Newmiller
On Thu, 6 Apr 2017, Massimo Bressan wrote: hello given my reproducible example #--- date<-seq(ISOdate(2017,1, 1, 0), by="hour", length.out = 48) v1<-1:48 df<-data.frame(date,v1) #-- "date" and "df" are functions in base R... best to avoid hiding them by re-using those names in the global e

Re: [R] readr to generate tibble from a character matrix

2017-04-06 Thread Ulrik Stervbo
Hi Ben, type.convert should do the trick: m %>% as_tibble() %>% lapply(type.convert) %>% as_tibble() I am not too happy about to double 'as_tibble' but it get the job done. HTH Ulrik On Thu, 6 Apr 2017 at 16:41 Ben Tupper wrote: > Hello, > > I have a workflow yields a character matrix

Re: [R] as.POSIXct character string is not in a standard unambiguous format

2017-04-06 Thread Sebastien Moretti
This is far from portable programming but as R looks to search for /etc/localtime it is simpler for me do like that. I will not patch R source code to make "make check" step works. Then for my own code, I will use x <- as.POSIXct(strptime("2002-02-02 02:02", "%Y-%m-%d %H:%M")) or Sys.set

Re: [R] as.POSIXct character string is not in a standard unambiguous format

2017-04-06 Thread Jeff Newmiller
I cannot imagine a less desirable solution. This is the opposite of portable programming. -- Sent from my phone. Please excuse my brevity. On April 6, 2017 5:29:08 AM PDT, Sebastien Moretti wrote: >I have just found the solution. > >We have a custom Linux distribution that allows us to have

Re: [R] A question on modeling brain growth using GAM

2017-04-06 Thread Simon Wood
> > gamObj=gam(brainVolume~ s(correctedAge) + s(subjIndexF, bs="re") + > s(subjIndexF, correctedAge, bs="re"), method="REML", data=mydata), > where subjIndexF is a factor for each subject. I was thrown an error > saying "more coefficients than data". > --- I'm not sure exactly how many scans a

Re: [R] as.POSIXct character string is not in a standard unambiguous format

2017-04-06 Thread Jeff Newmiller
You always need to set your timezone somehow when converting to POSIXt. Technically the method for doing this varies by OS, but on all environments I have worked with you can set the default timezone with something like Sys.setenv( TZ="Etc/GMT+5" ) In your example, some timezones supporting da

[R] readr to generate tibble from a character matrix

2017-04-06 Thread Ben Tupper
Hello, I have a workflow yields a character matrix that I convert to a tibble. Here is a simple example. library(tibble) library(readr) m <- matrix(c(letters[1:12], 1:4, (11:14 + 0.2)), ncol = 5) colnames(m) <- LETTERS[1:5] x <- as_tibble(m) # # A tibble: 4 × 5 # A B C D

Re: [R] plotting gam plots from mgcv package

2017-04-06 Thread Simon Wood
See 'shade' parameter in ?plot.gam (mgcv) On 06/04/17 00:34, Husam El Alqamy wrote: Dear List I am fitting some GAM models using the package mgcv. When plotting the response curves of the individual predictors using gam.plot I get a dotted line of the confidence interval around the fitted line.

Re: [R] conditional regression with mgcv

2017-04-06 Thread Simon Wood
My guess is that the model has identifiability problems and that this is then causing a problem (not caught properly) in the model fitting optimizer. Is there any chance you could send data that produces the problem (off list) and I can try it out (I will only use any data for this investigatio

Re: [R] as.POSIXct character string is not in a standard unambiguous format

2017-04-06 Thread Sebastien Moretti
I have just found the solution. We have a custom Linux distribution that allows us to have several R (+ glibc and others) versions in parallel for tools related to our job domain. We have another etc/ folder for those tools and R looks for the localtime file there, not in /etc/. So linking /

Re: [R] A question on modeling brain growth using GAM

2017-04-06 Thread Simon Wood
If 'subjIndexF' is a factor for subject, then s(subjIndexF, bs="re") will produce a random effect for subject. i.e. each subject will be given its own random intercept term, which is a way that repeated measures data like this are often handled. The reason for the s(subjIndexF, bs="re") syntax

[R] average at specific hour "endpoints" of the day

2017-04-06 Thread Massimo Bressan
hello given my reproducible example #--- date<-seq(ISOdate(2017,1, 1, 0), by="hour", length.out = 48) v1<-1:48 df<-data.frame(date,v1) #-- I need to calculate the average of variable v1 at specific hour "endpoints" of the day: i.e. at hours 6.00 and 22.00 respectively the desired resu

Re: [R] taking a small piece of large tiff

2017-04-06 Thread Ranjan Maitra
Hello Louisa, THis is not a R solution but would it not be easier to use ImageMagick to do what you are wanting to do? Look up https://www.imagemagick.org/script/index.php HTH, Ranjan On Wed, 5 Apr 2017 08:23:51 +0100 Louisa Reynolds via R-help wrote: > Ok. I have a tiff of size over 2GB. It

[R] Using R Markdown for creating reproducible manuscripts – new blog post from eLife Labs

2017-04-06 Thread Emily Packer
[With apologies for cross-posting] Hi all, We have today published a blog post on eLife Labs about how scientists can use the dynamic document language, R Markdown, for creating reproducible manuscripts. At eLife, we aim to make the communication of results more beneficial for the scientific com