Re: [R] Problem with my function using as.POSIXct

2018-03-28 Thread Jeff Newmiller
You have succeeded, but you just don't know it. The POSIXct object is representing that instant of time internally... you are just complaining about how it is printing it. So convert it to character explicitly with the desired format when you want to print it. as.character(

[R] Problem with my function using as.POSIXct

2018-03-28 Thread Thomas Adams
Hello all: I wrote a function: my.bastimeToSynoptic <- function(x) { f<-unlist(strsplit(as.character(x), " ")) hr<-unlist(strsplit(f[2], ":")) if(as.numeric(hr[1])<6) { synoptic<-"00" } else { synoptic<-as.integer(as.numeric(hr[1])/6)*6 }

Re: [R] can not install package "matie"

2018-03-28 Thread Jeff Newmiller
Varin In the teaching you to fish department, you can find those dependencies Duncan appeared to pull out of thin air by looking at the CRAN contributed packages web pages, which can easily be found with Google. Start at the matie page and follow the dependency links and look at dependencies.

Re: [R] Creating the right table from lapply list

2018-03-28 Thread MacQueen, Don
Perhaps this toy example will help: ## example data output <- list(1:5, 1:7, 1:4) lens <- lapply(output, length) maxlen <- max(unlist(lens)) outputmod <- lapply(output, function(x, maxl) c(x, rep(NA, maxl-length(x))), maxl=maxlen) outputmat <- do.call(cbind, outputmod) write.csv(outputmat,

Re: [R] can not install package "matie"

2018-03-28 Thread Duncan Murdoch
On 28/03/2018 6:27 PM, varin sacha via R-help wrote: Dear R-experts, I can not install the package "matie". If somebody can tell me where the problem is. install.packages("matie") Installing package into ‘/Users/Caro/Library/R/3.3/library’ (as ‘lib’ is unspecified) essai de l'URL

[R] can not install package "matie"

2018-03-28 Thread varin sacha via R-help
Dear R-experts, I can not install the package "matie". If somebody can tell me where the problem is. > install.packages("matie") Installing package into ‘/Users/Caro/Library/R/3.3/library’ (as ‘lib’ is unspecified) essai de l'URL

Re: [R] Creating the right table from lapply list

2018-03-28 Thread Bert Gunter
If I understand correctly, this query is really about how to organize your data, not how to use R code to do it, though that may come later. Of course, the first question is why mess with Excel at all? But I shall assume you have good reason to get your data into Excel and do what you want to with

Re: [R] Using R and the Tidyverse for an economic model

2018-03-28 Thread Jocelyn Ireson-Paine via R-help
Jeff, thanks for taking the time to read and comment. About the points you raise: 1) Packages. I do understand the advantages of packages. But I'm still prototyping, and it seemed too complicated to make every source file a separate package, when I'm still often moving source code from one to

[R] coxme in R underestimates variance of random effect, when random effect is on observation level

2018-03-28 Thread Alexander Pate
Hello, I have a question concerning fitting a cox model with a random intercept, also known as a frailty model. I am using both the coxme package, and the frailty statement in coxph. Often 'shared' frailty models are implemented in practice, to group people who are from a cluster to account

Re: [R] netCDF to GeoTIFF by layer in r

2018-03-28 Thread Ahmed Attia
Hi Ben, Adding 'band' to raster provided what I want; importnetcdf <- raster(file.nc,band=4) writeRaster(importnetcdf,file.tiff,"GTiff",overwrite=FALSE) Thanks for your help. Ahmed Ahmed Attia, Ph.D. Agronomist & Soil Scientist On Wed, Mar 28, 2018 at 11:53 AM, Ben Tupper

Re: [R] netCDF to GeoTIFF by layer in r

2018-03-28 Thread Ben Tupper
Hi Ahmed, When reading from a ncdf file you can use the 'varname', 'lvar' and 'level' arguments - see the 'Details' section in the docs https://www.rdocumentation.org/packages/raster/versions/2.6-7/topics/raster We

[R] "dlm" Package: Calculating State Confidence Intervals

2018-03-28 Thread Elmously, Ziad (TSHHM)
To Whom It May Concern, I estimated a model with 6 states (3 time-varying Regression parameters and 3 quarterly seasonality trends). The model is saved in the object titled "mod." Following the example in the documentation and using the commands below, I am attempting to use the function

[R] Fwd: netCDF to GeoTIFF by layer in r

2018-03-28 Thread Ahmed Attia
Hi I have a netCDF file of volumetric soil water content at four different soil layers and want to convert each soil layer in the netCDF file to a GeoTIFF layer. This code converts the netCDF file to one GeoTIFF layer, i.e. unclear which soil depth. file.nc <-

Re: [R] R and Java 10 ➜ rJava not able to build

2018-03-28 Thread Luis Puerto
Hi Ista! Thanks a lot for your support!! It puzzles me because it’s the first time that something like this happens to me. I’m aware that root and user don’t have the same environmental variables here. However, I don’t know why root chooses Java 9 and my user chooses Java 10. Isn’t Java 10

Re: [R] R and Java 10 ➜ rJava not able to build

2018-03-28 Thread Ista Zahn
On Wed, Mar 28, 2018 at 3:56 AM, Luis Puerto wrote: > Hi Jeff!! > > I really don’t know if running R CMD javareconf with sudo has posed a problem > here, now or in the past. What I know is sometimes it’s the only way to > really config it, if I don’t run with sudo, in

Re: [R] R and Java 10 ➜ rJava not able to build

2018-03-28 Thread Ista Zahn
On Tue, Mar 27, 2018 at 9:39 PM, Jeff Newmiller wrote: > I am not a Mac user, but I do use Linux and I would recommend not running R > with sudo unless you are an admin ninja. That defensive practice would render > the answer to your question moot. I don't think this

Re: [R] unable to move temporary installation of package

2018-03-28 Thread Kevin E. Thorpe
I am glad you found the culprit. I will tuck that additional piece of info away for the next time my students have trouble. Kevin On 03/27/2018 09:22 PM, Paul Lantos wrote: I think MalwareBytes may have been the culprit. I disabled it and it's working now (even with my regular antivirus

Re: [R] R and Java 10 ➜ rJava not able to build

2018-03-28 Thread Luis Puerto
Hi Jeff!! I really don’t know if running R CMD javareconf with sudo has posed a problem here, now or in the past. What I know is sometimes it’s the only way to really config it, if I don’t run with sudo, in the end it asks me if I want to overwrite the configuration from root override