Re: [R] How to save Results in svg format

2020-12-03 Thread David Carlson
If you look at the examples on the manual pages for the upgma() and NJ()
functions you will see that the results are generally sent to the plot()
function. To save that graph as an .svg file you need to open a graphics
device using the svg() function, plot the data, and close the graphics
device. You probably need something like the following:

svg("UPGMA_5x5.svg")
plot(UPGMA_5x5)
dev.off()

or

svg("NJ_119x119.svg")
plot(NJ_119x119)
dev.off()

There are numerous arguments that set various details for the plot that you
should look at (?svg).

David L Carlson
Texas A University


On Thu, Dec 3, 2020 at 10:24 PM Anas Jamshed 
wrote:

> #Loading the required libraries
> library(ape)
> library(phangorn)
> library(seqinr)
> #Importing the required file
> align_5 <- read.alignment("C:/Users/VAMSI/align 5.fasta", format = "fast")
> align_119 <- read.alignment("C:/Users/VAMSI/align 119.fasta", format =
> "fasta")
> Computing the distance matrix for both UPGMA and NJ algorithms
> implementation.
>  matrix_5x5 <- dist.alignment(align_5, matrix = "identity")
> summary(matrix_5x5)
>
> matrix_119x119 <- dist.alignment(align_119, matrix = "identity")
> summary(matrix_119x119)
> #Implementation of UPGMA algorithm for a small matrix (5x5) and entire
> matrix (119x119)
> UPGMA_5x5 <- upgma(matrix_5x5)
> UPGMA_119x119 <- upgma(matrix_119x119)
> summary(UPGMA_5x5)
>
> summary(UPGMA_119x119)
> #Implementation of NJ algorithm for a small matrix (5x5) and entire
> matrix (119x119)
> NJ_5x5 <- NJ(matrix_5x5)
> NJ_119x119 <- NJ(matrix_119x119)
> summary(NJ_5x5)
>
> summary(NJ_119x119)
>
>
> I have done this whole analysis but don't know how can I  the save my
> tree file in svg or some other image format . In the avove script , I
> am applying the phylogenetic algorithm on the distance matrix which I
> have created through fasta file
>
> [[alternative HTML version deleted]]
>
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
>
> https://urldefense.com/v3/__https://stat.ethz.ch/mailman/listinfo/r-help__;!!KwNVnqRv!T-8PRCLc041aD-rW1ehtb14tfQAVpWdpBddf_q6Raeho0RbG9wDodEK_QDpGMCc$
> PLEASE do read the posting guide
> https://urldefense.com/v3/__http://www.R-project.org/posting-guide.html__;!!KwNVnqRv!T-8PRCLc041aD-rW1ehtb14tfQAVpWdpBddf_q6Raeho0RbG9wDodEK_1H9sJRs$
> and provide commented, minimal, self-contained, reproducible code.
>

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Save Results in svg format

2020-12-03 Thread David Winsemius



On 12/3/20 7:12 PM, Anas Jamshed wrote:

#Loading the required libraries
library(ape)
library(phangorn)
library(seqinr)
#Importing the required file
align_5 <- read.alignment("C:/Users/VAMSI/align 5.fasta", format = "fast")
align_119 <- read.alignment("C:/Users/VAMSI/align 119.fasta", format = "fasta")
Computing the distance matrix for both UPGMA and NJ algorithms implementation.
  matrix_5x5 <- dist.alignment(align_5, matrix = "identity")
summary(matrix_5x5)

matrix_119x119 <- dist.alignment(align_119, matrix = "identity")
summary(matrix_119x119)
#Implementation of UPGMA algorithm for a small matrix (5x5) and entire
matrix (119x119)
UPGMA_5x5 <- upgma(matrix_5x5)
UPGMA_119x119 <- upgma(matrix_119x119)
summary(UPGMA_5x5)

summary(UPGMA_119x119)
#Implementation of NJ algorithm for a small matrix (5x5) and entire
matrix (119x119)
NJ_5x5 <- NJ(matrix_5x5)
NJ_119x119 <- NJ(matrix_119x119)
summary(NJ_5x5)

summary(NJ_119x119)


I have done this whole analysis but don't know how can I  the save my
tree file in svg or some other image format



SVG format is for graphics. I don't see any R graphics calls or anything 
I recognize as a "tree". (Perhaps the summary function for objects 
returned from `upgma` include graphics? I surely do not know.)


Cairo graphics is supported in the grDevices package. It should be 
loaded by default. Have your tried this at your console:



?svg


--

David.



[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Is there any criteria to compare different models?

2020-12-03 Thread Bert Gunter
Per the posting guide linked below (have you read it??):

"*Questions about statistics:* The R mailing lists are primarily intended
for questions and discussion about the R software. However, questions about
statistical methodology are sometimes posted. If the question is well-asked
and of interest to someone on the list, it *may* elicit an informative
up-to-date answer. See also the Usenet groups sci.stat.consult (applied
statistics and consulting) and sci.stat.math (mathematical stat and
probability).*"*

So don't be surprised if you don't receive any response.

You might also try posting at stats.stackexchange.com. No guarantees there
either.


Bert Gunter

"The trouble with having an open mind is that people keep coming along and
sticking things into it."
-- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )


On Thu, Dec 3, 2020 at 8:09 PM Saman Zahid  wrote:

> Hi,
>
> I am trying to make comparison between the lm, gam(mgcv) and lme(nlme)
> models. The problem is I am not able to find a single criterion on which
> these 3 models are comparable.
>
> I am using method "ML" for both gam and lme, yet the AIC and BIC formulas
> differ due to the degrees of freedom.
>
> Is there any statistical way to compare these three models?
>
> I will really appreciate your help.
>
> Thanks
> Saman Zahid
>
> [[alternative HTML version deleted]]
>
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] How to save Results in svg format

2020-12-03 Thread Anas Jamshed
#Loading the required libraries
library(ape)
library(phangorn)
library(seqinr)
#Importing the required file
align_5 <- read.alignment("C:/Users/VAMSI/align 5.fasta", format = "fast")
align_119 <- read.alignment("C:/Users/VAMSI/align 119.fasta", format = "fasta")
Computing the distance matrix for both UPGMA and NJ algorithms implementation.
 matrix_5x5 <- dist.alignment(align_5, matrix = "identity")
summary(matrix_5x5)

matrix_119x119 <- dist.alignment(align_119, matrix = "identity")
summary(matrix_119x119)
#Implementation of UPGMA algorithm for a small matrix (5x5) and entire
matrix (119x119)
UPGMA_5x5 <- upgma(matrix_5x5)
UPGMA_119x119 <- upgma(matrix_119x119)
summary(UPGMA_5x5)

summary(UPGMA_119x119)
#Implementation of NJ algorithm for a small matrix (5x5) and entire
matrix (119x119)
NJ_5x5 <- NJ(matrix_5x5)
NJ_119x119 <- NJ(matrix_119x119)
summary(NJ_5x5)

summary(NJ_119x119)


I have done this whole analysis but don't know how can I  the save my
tree file in svg or some other image format . In the avove script , I
am applying the phylogenetic algorithm on the distance matrix which I
have created through fasta file

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Is there any criteria to compare different models?

2020-12-03 Thread Saman Zahid
Hi,

I am trying to make comparison between the lm, gam(mgcv) and lme(nlme)
models. The problem is I am not able to find a single criterion on which
these 3 models are comparable.

I am using method "ML" for both gam and lme, yet the AIC and BIC formulas
differ due to the degrees of freedom.

Is there any statistical way to compare these three models?

I will really appreciate your help.

Thanks
Saman Zahid

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Save Results in svg format

2020-12-03 Thread Bert Gunter
Warning: I have basically no idea what you are doing. I presume that you
have consulted ?svg, however. If not , you should probably do so.

Also, a search on "save as svg" on rseek.org  brought up the svglite
package, among other resources. You might want to see what that offers.

Cheers,
Bert Gunter

"The trouble with having an open mind is that people keep coming along and
sticking things into it."
-- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )


On Thu, Dec 3, 2020 at 7:12 PM Anas Jamshed 
wrote:

> #Loading the required libraries
> library(ape)
> library(phangorn)
> library(seqinr)
> #Importing the required file
> align_5 <- read.alignment("C:/Users/VAMSI/align 5.fasta", format = "fast")
> align_119 <- read.alignment("C:/Users/VAMSI/align 119.fasta", format =
> "fasta")
> Computing the distance matrix for both UPGMA and NJ algorithms
> implementation.
>  matrix_5x5 <- dist.alignment(align_5, matrix = "identity")
> summary(matrix_5x5)
>
> matrix_119x119 <- dist.alignment(align_119, matrix = "identity")
> summary(matrix_119x119)
> #Implementation of UPGMA algorithm for a small matrix (5x5) and entire
> matrix (119x119)
> UPGMA_5x5 <- upgma(matrix_5x5)
> UPGMA_119x119 <- upgma(matrix_119x119)
> summary(UPGMA_5x5)
>
> summary(UPGMA_119x119)
> #Implementation of NJ algorithm for a small matrix (5x5) and entire
> matrix (119x119)
> NJ_5x5 <- NJ(matrix_5x5)
> NJ_119x119 <- NJ(matrix_119x119)
> summary(NJ_5x5)
>
> summary(NJ_119x119)
>
>
> I have done this whole analysis but don't know how can I  the save my
> tree file in svg or some other image format
>
> [[alternative HTML version deleted]]
>
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Save Results in svg format

2020-12-03 Thread Anas Jamshed
#Loading the required libraries
library(ape)
library(phangorn)
library(seqinr)
#Importing the required file
align_5 <- read.alignment("C:/Users/VAMSI/align 5.fasta", format = "fast")
align_119 <- read.alignment("C:/Users/VAMSI/align 119.fasta", format = "fasta")
Computing the distance matrix for both UPGMA and NJ algorithms implementation.
 matrix_5x5 <- dist.alignment(align_5, matrix = "identity")
summary(matrix_5x5)

matrix_119x119 <- dist.alignment(align_119, matrix = "identity")
summary(matrix_119x119)
#Implementation of UPGMA algorithm for a small matrix (5x5) and entire
matrix (119x119)
UPGMA_5x5 <- upgma(matrix_5x5)
UPGMA_119x119 <- upgma(matrix_119x119)
summary(UPGMA_5x5)

summary(UPGMA_119x119)
#Implementation of NJ algorithm for a small matrix (5x5) and entire
matrix (119x119)
NJ_5x5 <- NJ(matrix_5x5)
NJ_119x119 <- NJ(matrix_119x119)
summary(NJ_5x5)

summary(NJ_119x119)


I have done this whole analysis but don't know how can I  the save my
tree file in svg or some other image format

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] A general question about targeted sequencing data analysis

2020-12-03 Thread Jeff Newmiller
My suggestion would be to ask this question in a forum devoted to that topic, 
such as the Bioconductor forum [1].

[1] https://www.bioconductor.org/help/support/

On December 3, 2020 11:25:24 AM PST, "Li, Aiguo (NIH/NCI) [E] via R-help" 
 wrote:
>Dear all,
>
>One of our PIs has a targeted sequencing dataset generated a while ago.
>He is interested in finding out VAF of a group of genes.  This is the
>first dataset of this types we have.  I would be appreciative for any
>suggestions on pipelines for analyzing this type of data.
>
>Thanks
>
>Anna
>
>   [[alternative HTML version deleted]]
>
>__
>R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
>https://stat.ethz.ch/mailman/listinfo/r-help
>PLEASE do read the posting guide
>http://www.R-project.org/posting-guide.html
>and provide commented, minimal, self-contained, reproducible code.

-- 
Sent from my phone. Please excuse my brevity.

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] A general question about targeted sequencing data analysis

2020-12-03 Thread Li, Aiguo (NIH/NCI) [E] via R-help
Dear all,

One of our PIs has a targeted sequencing dataset generated a while ago.  He is 
interested in finding out VAF of a group of genes.  This is the first dataset 
of this types we have.  I would be appreciative for any suggestions on 
pipelines for analyzing this type of data.

Thanks

Anna

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] [R-pkgs] mapSpain on CRAN

2020-12-03 Thread Diego Hernangómez Herrero
Dear R users:

mapSpain is now available on CRAN. This package provides the administrative
boundaries of Spain at several levels: all NUTS levels, Autonomous
Communities , Provinces and municipalities (sf objects).

The package also has the ability of downloading WMS/WMTS geotagged images
of different public organisms of Spain for static  maps, a leaflet plugin
for the same providers to use with R leaflet and many other features.

Full documentation and vignettes on:

https://dieghernan.github.io/mapSpain/


Hope this can be useful, regards
-- 



Have a nice day!

[[alternative HTML version deleted]]

___
R-packages mailing list
r-packa...@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-packages

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Download data ph soil

2020-12-03 Thread Jim Lemon
Hi Jose,
Searching for "soil pH data" reveals a bucketload of sites with this
sort of data in lots of formats.

Jim



On Thu, Dec 3, 2020 at 10:07 PM José Luis Aguilar
 wrote:
>
> Dear list members,
>
> I am looking for soil pH data for Europe and Africa, but I don't.
> I need them to set up a map in R for my research.
>
> Please, someone where to find this data in tif formats preferably.
>
> thank you
>
> [[alternative HTML version deleted]]
>
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Download data ph soil

2020-12-03 Thread José Luis Aguilar
Dear list members,

I am looking for soil pH data for Europe and Africa, but I don't.
I need them to set up a map in R for my research.

Please, someone where to find this data in tif formats preferably.

thank you

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R-es] Paquete mapSpain en CRAN

2020-12-03 Thread miguel.angel.rodriguez.muinos
Gracias Diego.

Un paquete muy interesante.

Un saludo,
Miguel.




De: R-help-es  en nombre de Diego Hernangómez 
Herrero 
Enviado: jueves, 3 de diciembre de 2020 10:10
Para: r-help-es@r-project.org
Asunto: [R-es] Paquete mapSpain en CRAN

Estimados usuarios de R:

Os informo que el paquete mapSpain ya está disponible en CRAN. Este paquete
proporciona mapas de España (formato sf) a diferentes niveles: NUTS,
Comunidades Autónomas, provincias y municipios.

También es posible descargar imágenes de servicios WMS/WTMS de
Administraciones Públicas españolas para su uso en mapas estáticos, e
incluye un plug-in para Rleaflet que permite añadir esos servicios como
capas del mapa.

El paquete incluye otras características, como mapas hexbin y de rejilla o
un diccionario que permite traducir nombres de regiones a las lenguas
cooficiales.

Espero que esta trabajo sea de interés y utilidad, la documentación
completa y varias viñetas en la web del proyecto:

https://dieghernan.github.io/mapSpain/

--



Have a nice day!

[[alternative HTML version deleted]]

___
R-help-es mailing list
R-help-es@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-help-es



Nota: A información contida nesta mensaxe e os seus posibles documentos 
adxuntos é privada e confidencial e está dirixida únicamente ó seu 
destinatario/a. Se vostede non é o/a destinatario/a orixinal desta mensaxe, por 
favor elimínea. A distribución ou copia desta mensaxe non está autorizada.

Nota: La información contenida en este mensaje y sus posibles documentos 
adjuntos es privada y confidencial y está dirigida únicamente a su 
destinatario/a. Si usted no es el/la destinatario/a original de este mensaje, 
por favor elimínelo. La distribución o copia de este mensaje no está autorizada.

See more languages: http://www.sergas.es/aviso-confidencialidad

___
R-help-es mailing list
R-help-es@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-help-es


Re: [R-es] Paquete mapSpain en CRAN

2020-12-03 Thread Emilio L. Cano
Estimado Diego,

Gracias por compartir, gran aportación que seguro simplifica la vida a muchxs 
eRRerxs.

Un saludo,
Emilio L. Cano


> El 3 dic 2020, a las 10:10, Diego Hernangómez Herrero 
>  escribió:
> 
> Estimados usuarios de R:
> 
> Os informo que el paquete mapSpain ya está disponible en CRAN. Este paquete
> proporciona mapas de España (formato sf) a diferentes niveles: NUTS,
> Comunidades Autónomas, provincias y municipios.
> 
> También es posible descargar imágenes de servicios WMS/WTMS de
> Administraciones Públicas españolas para su uso en mapas estáticos, e
> incluye un plug-in para Rleaflet que permite añadir esos servicios como
> capas del mapa.
> 
> El paquete incluye otras características, como mapas hexbin y de rejilla o
> un diccionario que permite traducir nombres de regiones a las lenguas
> cooficiales.
> 
> Espero que esta trabajo sea de interés y utilidad, la documentación
> completa y varias viñetas en la web del proyecto:
> 
> https://dieghernan.github.io/mapSpain/
> 
> -- 
> 
> 
> 
> Have a nice day!
> 
>   [[alternative HTML version deleted]]
> 
> ___
> R-help-es mailing list
> R-help-es@r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-help-es

___
R-help-es mailing list
R-help-es@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-help-es


Re: [R] change frequency of wind data correctly

2020-12-03 Thread Stefano Sofia
Thank you Jim for your solution.
I understood everything. As you say, splitting the POSIXct field is the key.

I apologise for not having used dput. I never used it but I will get aknowleged 
with it in a short time.

Thank you
Stefano

 (oo)
--oOO--( )--OOo
Stefano Sofia PhD
Civil Protection - Marche Region
Meteo Section
Snow Section
Via del Colle Ameno 5
60126 Torrette di Ancona, Ancona
Uff: 071 806 7743
E-mail: stefano.so...@regione.marche.it
---Oo-oO


Da: Jim Lemon [drjimle...@gmail.com]
Inviato: giovedì 3 dicembre 2020 4.41
A: Stefano Sofia
Cc: r-help mailing list
Oggetto: Re: [R] change frequency of wind data correctly

Hi again,
Didn't realize that the example didn't even span a full day.

ssdf<-read.table(text="date_POSIX time_POSIX vmax
 2018-02-01 00:00:00 27
 2018-02-01 00:10:00 41
 2018-02-01 00:20:00 46
 2018-02-01 00:30:00 39
 2018-02-01 00:40:00 34
 2018-02-01 00:50:00 32
 2018-02-01 01:00:00 37
 2018-02-01 01:10:00 31
 2018-02-01 01:20:00 26
 2018-02-01 01:30:00 29
 2018-02-01 01:40:00 24
 2018-02-01 01:50:00 35",
 header=TRUE,stringsAsFactors=FALSE)
# extract the hour
ssdf$hour<-
 as.numeric(unlist(lapply(strsplit(ssdf$time_POSIX,":"),"[",1)))
# get the time of day as seconds from the time field
ssdf$mins<-
 as.numeric(unlist(lapply(strsplit(ssdf$time_POSIX,":"),"[",2)))
# create an AM/PM variable
ssdf$ampm<-ifelse(ssdf$mins > 0 & ssdf$mins <= 30,"am","pm")
# drop first row
ssdf<-ssdf[-1,]
means<-aggregate(vmax~hour+ampm,ssdf,mean)

This does a full day. To do more, add the date_POSIX field to the
aggregate command. If you have the date and time in one field you'll
have to split that. That will distinguish the AM/PM means in each day
as well as hour.

Jim

On Thu, Dec 3, 2020 at 2:10 PM Jim Lemon  wrote:
>
> Hi Stefano,
> I read in your date-time as two separate fields for convenience. You
> can split your single field at the space to get the same result.
>
> ssdf<-read.table(text="date_POSIX time_POSIX vmax
>  2018-02-01 00:00:00 27
>  2018-02-01 00:10:00 41
>  2018-02-01 00:20:00 46
>  2018-02-01 00:30:00 39
>  2018-02-01 00:40:00 34
>  2018-02-01 00:50:00 32",
>  header=TRUE,stringsAsFactors=FALSE)
> # get the time of day as seconds from the time field
> ssdf$seconds<-as.numeric(strptime(ssdf$time_POSIX,"%H:%M:%S"))
> # subtract whatever current date strptime guesses for the date
> ssdf$seconds<-ssdf$seconds-min(ssdf$seconds)
> # create an AM/PM variable
> ssdf$ampm<-ifelse(ssdf$seconds > 0 & ssdf$seconds <= 1800,"am","pm")
> means<-aggregate(vmax~ampm,ssdf,mean)
>
> Jim
>
> On Thu, Dec 3, 2020 at 4:55 AM Stefano Sofia
>  wrote:
> >
> > Dear list users,
> > I have wind data with frequency of 10 minutes (three years data). For 
> > simplicity let me use only max wind speed.
> > I need to reduce the frequency to 30 minutes,  at  00 (taking the mean of 
> > data at 40, 50 and 00 minutes) and at 30 (taking the mean of data at 10, 20 
> > and 30 minutes) of each hour.
> >
> > The simple code here reported works well, but the column "interval" groups 
> > data forward, not backward:
> >
> > init_day <- as.POSIXct("2018-02-01-00-00", format="%Y-%m-%d-%H-%M", 
> > tz="Etc/GMT-1")
> > fin_day <- as.POSIXct("2018-02-01-02-00", format="%Y-%m-%d-%H-%M", 
> > tz="Etc/GMT-1")
> > mydf <- data.frame(data_POSIX=seq(init_day, fin_day, by="10 mins"))
> > mydf$vmax <- round(rnorm(13, 35, 10))
> > mydf$interval <- cut(mydf$data_POSIX, , breaks="30 min")
> > means <- aggregate(vmax ~ interval, mydf, mean)
> >
> > data_POSIX  vmax  interval
> > 1  2018-02-01 00:00:00 27 2018-02-01 00:00:00
> > 2  2018-02-01 00:10:00 41 2018-02-01 00:00:00
> > 3  2018-02-01 00:20:00 46 2018-02-01 00:00:00
> > 4  2018-02-01 00:30:00 39 2018-02-01 00:30:00
> > 5  2018-02-01 00:40:00 34 2018-02-01 00:30:00
> > 6  2018-02-01 00:50:00 32 2018-02-01 00:30:00
> > ...
> >
> > I should work with
> >
> > data_POSIX  vmax  interval
> > 1  2018-02-01 00:00:00 27 2018-02-01 00:00:00
> > 2  2018-02-01 00:10:00 41 2018-02-01 00:30:00
> > 3  2018-02-01 00:20:00 46 2018-02-01 00:30:00
> > 4  2018-02-01 00:30:00 39 2018-02-01 00:30:00
> > 5  2018-02-01 00:40:00 34 2018-02-01 00:00:00
> > 6  2018-02-01 00:50:00 32 2018-02-01 00:00:00
> > ...
> >
> >
> > Is there a way to modify this code to groupp data correctly? (I would 
> > prefer using only the base package)
> >
> > Thank you for your help
> > Stefano
> >
> >
> >
> >  (oo)
> > --oOO--( )--OOo
> > Stefano Sofia PhD
> > Civil Protection - Marche Region
> > Meteo Section
> > Snow Section
> > Via del Colle Ameno 5
> > 60126 Torrette di Ancona, Ancona
> > Uff: 071 806 7743
> > E-mail: stefano.so...@regione.marche.it
> > ---Oo-oO
> >
> > 
> >
> > AVVISO IMPORTANTE: Questo messaggio di posta 

[R-es] Paquete mapSpain en CRAN

2020-12-03 Thread Diego Hernangómez Herrero
Estimados usuarios de R:

Os informo que el paquete mapSpain ya está disponible en CRAN. Este paquete
proporciona mapas de España (formato sf) a diferentes niveles: NUTS,
Comunidades Autónomas, provincias y municipios.

También es posible descargar imágenes de servicios WMS/WTMS de
Administraciones Públicas españolas para su uso en mapas estáticos, e
incluye un plug-in para Rleaflet que permite añadir esos servicios como
capas del mapa.

El paquete incluye otras características, como mapas hexbin y de rejilla o
un diccionario que permite traducir nombres de regiones a las lenguas
cooficiales.

Espero que esta trabajo sea de interés y utilidad, la documentación
completa y varias viñetas en la web del proyecto:

https://dieghernan.github.io/mapSpain/

-- 



Have a nice day!

[[alternative HTML version deleted]]

___
R-help-es mailing list
R-help-es@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-help-es