Re: [R] iterators : checkFunc with ireadLines

2020-05-18 Thread Laurent Rhelp
GREAT ! It is exactly in the idea of my request ! I like the nextElem call in the skip argument. Thank you very much William Best Regards Laurent Le 18/05/2020 à 20:37, William Michels a écrit : Hi Laurent, Thank you for explaining your size limitations. Below is an example using the

Re: [R] iterators : checkFunc with ireadLines

2020-05-18 Thread Laurent Rhelp
Dear William,  Thank you for your answer My file is very large so I cannot read it in my memory (I cannot use read.table). So I want to put in memory only the line I need to process. With readLines, as I did, it works but I would like to use an iterator and a foreach loop to understand this

Re: [R] iterators : checkFunc with ireadLines

2020-05-18 Thread William Michels via R-help
Dear Laurent, I'm going through your code quickly, and the first question I have is whether you loaded the "gmp" library? > library(gmp) Attaching package: ‘gmp’ The following objects are masked from ‘package:base’: %*%, apply, crossprod, matrix, tcrossprod > library(iterators) >

Re: [R] iterators : checkFunc with ireadLines

2020-05-18 Thread William Michels via R-help
Apologies, Laurent, for this two-part answer. I misunderstood your post where you stated you wanted to "filter(ing) some selected lines according to the line name... ." I thought that meant you had a separate index (like a series of primes) that you wanted to use to only read-in selected line

Re: [R] iterators : checkFunc with ireadLines

2020-05-18 Thread William Michels via R-help
Hi Laurent, Thank you for explaining your size limitations. Below is an example using the read.fwf() function to grab the first column of your input file (in 2000 row chunks). This column is converted to an index, and the index is used to create an iterator useful for skipping lines when

Re: [R] iterators : checkFunc with ireadLines

2020-05-18 Thread Laurent Rhelp
Dear William,  Thank you for your answer My file is very large so I cannot read it in my memory (I cannot use read.table). So I want to put in memory only the line I need to process. With readLines, as I did, it works but I would like to use an iterator and a foreach loop to understand this

Re: [R] Classification of wind events

2020-05-18 Thread Jim Lemon
Sorry, I should know better: rollmean<-function(x,width=2) { lenx<-length(x) result<-rep(NA,lenx) for(i in 1:lenx) { chunk<-i:(i+width-1) if(i(lenx-width)) chunk<-c(i:lenx,rep(lenx,i-(width-1))) result[i]<-mean(x[chunk]) } return(result) } I forgot to replace this with: library(zoo)

[R] rgl 0.100.54 using rgl.setMouseCallbacks in pan3d with rglwidget() and shiny server

2020-05-18 Thread Kennard McDaniel
I am currently attempting to implement rgl and the pan3d function on a shiny server but can't get the pan3d function to work. Using the right mouse button (2).  Here is a little sample code I was using to try to get it to work. Session info below the signature line.  options(rgl.useNULL =

Re: [R] Classification of wind events

2020-05-18 Thread Jeff Newmiller
? source("../rollmean.R") ? On May 18, 2020 4:11:52 AM PDT, Jim Lemon wrote: >Hi Stefano, >If I understand your request, this may also help, Uses the same data >transformations as my previous email. > >png("SS_foehn.png") >plot(mydf$data_POSIX, > ifelse(mydf$main_dir %in%

Re: [R] Classification of wind events

2020-05-18 Thread Jeff Newmiller
While I can understand that such techniques might not seem obvious at first, they are building blocks that you should be able to use to solve similar problems in the future. Don't give up because it surprised you this time, and do play with modifying it to better understand this time. Replace

Re: [R] Help with spTransform() function and final plot colors

2020-05-18 Thread Poling, William via R-help
Thank you Ege, I appreciate your response. I have move this to r-sig-geo. WHP Proprietary -Original Message- From: Ege Rubak Sent: Monday, May 18, 2020 6:41 AM To: Poling, William ; r-help@r-project.org Subject: [EXTERNAL] Re: [R] Help with spTransform() function and final plot

Re: [R] Help with spTransform() function and final plot colors

2020-05-18 Thread Ege Rubak
You are more likely to get help with specific problems related to spTransform() on the dedicated list r-sig-geo. You should provide a minimal reproducible example. Your code refers to e.g. the object `tmp1b`, which we don't have. I think the spTransform() part will work with this correction: xy

Re: [R] Classification of wind events

2020-05-18 Thread Jim Lemon
Hi Stefano, If I understand your request, this may also help, Uses the same data transformations as my previous email. png("SS_foehn.png") plot(mydf$data_POSIX, ifelse(mydf$main_dir %in% c("WSW","SW"),mydf$max_speed,NA), type="b",main="Wind speed (WSW or SW) by time", xlab="Time of

Re: [R] Classification of wind events

2020-05-18 Thread Stefano Sofia
Sorry for my fault. I am very grateful for such code, which is extremely efficient. I would have never been able to reach these results. In order to preserve the quality of this code, I dare to ask you a final question: once identified each single period in the column foehn1c, this period can