Re: [R] Kalman filter

2010-11-20 Thread Stefano Sofia
Federico, as far as I understand Kalman filter works under gaussian conditions, and for this reason it is not implemented. (I have to admit that I do not know the sspir package) hope this helps, and correct me if I am wrong Best regards Stefano Sofia PhD On 11/17/2010 11:49 AM, feder wrote

[R] Query: sampling from a multivariate normal distribution using the singular value decomposition

2010-01-02 Thread Stefano Sofia
Dear R-list users, this question is not strictly related to R, but hopefully somebody will be able to answer. In a schematic way, which is the algorithm to sample from a multivariate normal distribution using the singular value decomposition? thank you for your help Stefano AVVISO IMPORTANTE:

[R] La.svd of a symmetric matrix

2010-01-16 Thread Stefano Sofia
Dear R list users, the singluar value decomposition of a symmetric matrix M is UDV^(T), where U = V. La.svd(M) gives as output three elements: the diagonal of D and the two orthogonal matrices u and vt (which is already the transpose of v). I noticed that the transpose of vt is not exactly u.

[R] La.svd of a symmetric matrix

2010-01-18 Thread Stefano Sofia
to understand when this option is impostant. Is it important to set mu=0 (only) when I deal with singular matrices? Thank you for your attention and your help Stefano Sofia Dear R list users, the singluar value decomposition of a symmetric matrix M is UDV^(T), where U = V. La.svd(M) gives

[R] Question: about loading a new package

2008-02-14 Thread Stefano Sofia
I am using R Version 2.3.1 (2006-06-01) in Linux with Ubuntu 7.4. I installed a new package with R CMD INSTALL -l /usr/lib/R/library newpackage.tar.gz Each time I run R I need to load this new package typing library(newpackage). My question is: how can I automatically load this new package

[R] Query: how to group data by months from a text file

2008-04-19 Thread Stefano Sofia
Dear R-users, I have to deal with (txt) files of the form 10092007 24.62 24.31 24.90 11092007 19.20 23.17 22.10 13092007 24.71 27.33 23.10 14092007 27.33 27.90 24.10 15092007 28.22 28.55 24.30 16092007 28.53 29.24 27.40 17092007 24.19 30.64 26.80 18092007 22.60 20.62 28.40 19092007 18.89 21.70

[R] Query: how to add quotes when importing a txt file

2008-05-09 Thread Stefano Sofia
Dear R users, I have a txt file of the form 10092007 24.62 24.31 24.90 11092007 19.20 23.17 22.10 13092007 24.71 27.33 23.10 14092007 27.33 27.90 24.10 15092007 28.22 28.55 24.30 16092007 28.53 29.24 27.40 17092007 24.19 30.64 26.80 18092007 22.60 20.62 28.40 19092007 8.89 1.70 14.70 20092007

[R] two simple questions about MCMCpoissonChange

2011-09-30 Thread Stefano Sofia
, this should be provided by users. What does 'no covariate' mean, within this model? thank you for your help Stefano Sofia AVVISO IMPORTANTE: Questo messaggio di posta elettronica può contenere informazioni confidenziali, pertanto è destinato solo a persone autorizzate alla ricezione. I messaggi di

[R] Query: list within a list

2012-02-22 Thread Stefano Sofia
1000 and store square matrices of dimension 13. Thank you for your attention and your help Stefano Sofia PhD AVVISO IMPORTANTE: Questo messaggio di posta elettronica può contenere informazioni confidenziali, pertanto è destinato solo a persone autorizzate alla ricezione. I messaggi di posta

[R] query about counting rows of a dataframe

2011-11-03 Thread Stefano Sofia
table(my_df$year_birth, my_df$month_birth, my_df$day_birth) which satisfies (partially) question numer 1 (I am not able to have 0 in the not available days). Is there a smart way to do that without invoking too many loops? thank you for your help Stefano Sofia AVVISO IMPORTANTE: Questo messaggio

[R] problems with dlmBSample of the dlm package

2012-01-23 Thread Stefano Sofia
Dear R users, I am trying to use the dlm package, and in particular the dlmBSample function. For some reason that I am not able to understand, this function does not work properly and the plot of the result does not make sense, while dlmFilter works perfectly. I think that my_mod is correct,

[R] Regression equation with a spline in gam (mgcv)

2012-06-19 Thread Stefano Sofia
71.1 4.86e-14 *** --- Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 R-sq.(adj) = 0.885 Deviance explained = 87.2% UBRE score = 0.13791 Scale est. = 1 n = 20 Thank you for your help Stefano Sofia AVVISO IMPORTANTE: Questo messaggio di posta elettronica può

[R] Equivalence between lm and glm

2013-05-29 Thread Stefano Sofia
Dear R-users, in case of linear model, lm(Y ~ X) is equivalent to glm(Y ~ X, family=gaussian(link=identity)) In case of the exponential model lm(log(Y) ~ X) why glm(Y ~ X, family=gaussian(link=log)) is not equivalent? Is there an equivalent glm to lm(log(Y) ~ X)? Thank you for your help Stefano

[R] R: Equivalence between lm and glm

2013-05-31 Thread Stefano Sofia
, in glm(Y ~ X, family=gaussian(link=log)) the regression is log(mu) = beta0 + beta1*X. In lm(log(Y) ~ X) the regression is exp(mu+(1/2)*sigma^2) = beta0 + beta1*X. Correct? Thank you for your help Stefano Sofia Da: peter dalgaard [pda...@gmail.com] Inviato

[R] Apply a Seasonal ARMA process

2013-06-21 Thread Stefano Sofia
for this topic in the R archive, but I have not been able to find an example or a useful hint. Could you please help me? Does arima handle seasonal ARMA processes? If yes, how? Is there a better specific package for that? Thank you for your help Stefano Sofia AVVISO

[R] Some days missing using xtabs

2013-07-23 Thread Stefano Sofia
Warning message: In `[-.factor`(`*tmp*`, ri, value = 1:31) : invalid factor level, NAs generated ? Thank you for your help Stefano Sofia AVVISO IMPORTANTE: Questo messaggio di posta elettronica può contenere informazioni confidenziali, pertanto è destinato solo

[R] R: Some days missing using xtabs

2013-07-23 Thread Stefano Sofia
Thanks to Rui Barradas and to Arun. Rui's considerations are very sensible, and they solved all my doubts. Thank you Stefano Da: Rui Barradas [ruipbarra...@sapo.pt] Inviato: martedì 23 luglio 2013 14.40 A: arun Cc: Stefano Sofia; R help Oggetto: Re: [R

[R] format for as.Date and inserting missing rows in a data frame

2014-03-04 Thread Stefano Sofia
Dear R users, I have a very long data frame (50 years, more than 1.5 million rows) of daily rainfall data from about 80 raingouges. The data frame that I have been given looks like Raingouge_number Station_number Year Month Day Rainfall 2004 2230 1951 1 1 2.60 2004 2230 1951 1 2 0.40 2004 2230

Re: [R] format for as.Date and inserting missing rows in a data frame

2014-03-10 Thread Stefano Sofia
-%d) dat1$Date1txt - format(dat1$Date1, %Y%m%d) Stefano Da: arun [smartpink...@yahoo.com] Inviato: martedì 4 marzo 2014 17.06 A: r-help@r-project.org Cc: Stefano Sofia Oggetto: Re: [R] format for as.Date and inserting missing rows in a data frame Hi, May

[R] F10.1 and i3 format in R

2014-03-10 Thread Stefano Sofia
Dear list members, I have to export (through 'write.table') a dataframe where two columns must be respectively F10.1 (floating with 10 digits, 1 of which for the decimal position) and i3 (integer of length 3). I looked at the 'format' options, but I couldn't see what I need. I also looked for

[R] Duplicate of columns when merging two data frames

2014-03-13 Thread Stefano Sofia
Dear list users, I have two data frames df1 and df2, where the columns of df1 are Sensor_RM Place_RM Station_RM Y_init_RM M_init_RM D_init_RM Y_fin_RM M_fin_RM D_fin_RM and the columns of df2 are Sensor_RM Station_RM Place_RM Province_RM Region_RM Net_init_RM GaussBoaga_EST_RM

[R] Question about rgamma when the shape and the scale are vectors, not scalars

2014-04-30 Thread Stefano Sofia
Dear list users, could somebody explain to me which is the meaning of rgamma(3, a, b) when both a and b are two vectors of length 3? I know that a is the shape and b is the scale, but I thought that they could only be scalars. Thank you for your help Stefano

[R] Group all the consecutive days

2013-10-02 Thread Stefano Sofia
Dear R-users, I have a data frame where in each row there is the daily rainfall cumulative; missing days mean that in that days rainfall has been zero. I need to group all the consecutive days in a single row and store in the field rainfall the sum of these consecutive days. Is there a reasonable

[R] R: Group all the consecutive days

2013-10-07 Thread Stefano Sofia
holtman [jholt...@gmail.com] Inviato: mercoledì 2 ottobre 2013 17.29 A: Stefano Sofia Cc: r-help@r-project.org Oggetto: Re: [R] Group all the consecutive days try this: rain - read.table(text = 'year month day rainfall landslide + 3 2007 6 6 1.6 0 + 4 2007 6 7 1.8 0 + 6 2007 6 12 4.6 0 + 8 2007 7 5

[R] Different information between correlation and frequency of a seasonal time series

2013-10-28 Thread Stefano Sofia
(and frequency is always 1). Differencing is not the best method to remove seasonal effects, but why it does not work at all? Could somebody give me some useful hints? Thank you for your help Stefano -- Stefano Sofia PhD Civil Protection of Marche Region

[R] Query: matrix definition

2011-02-21 Thread Stefano Sofia
at the beginning, without possibility of changing it throughout the code? Secondly, is it possible to define mymat as a matrix of integers, with no possibility of loading real numbers? Thank you for your help Stefano Sofia AVVISO IMPORTANTE: Questo messaggio di posta elettronica può contenere informazioni

[R] Columns perfectly aligned with the column names

2013-03-25 Thread Stefano Sofia
/KALMAN_DEV2/output/MAIL.txt, sep = \t, row.names=FALSE, col.names = TRUE, quote=FALSE, qmethod=double) Thank you for your help Stefano Sofia AVVISO IMPORTANTE: Questo messaggio di posta elettronica può contenere informazioni confidenziali, pertanto è destinato solo a persone autorizzate alla

[R] Create a vector without using an external 'if statement'

2013-04-02 Thread Stefano Sofia
]) creates (-999,14,5) while I need (NA,14,5) Can I do it directly while I create my_array, without using an external if statement? Thank you for your help Stefano Sofia AVVISO IMPORTANTE: Questo messaggio di posta elettronica può contenere informazioni confidenziali, pertanto è destinato solo

[R] use of simulate.Arima (forecast package)

2013-04-15 Thread Stefano Sofia
I would like to simulate some SARIMA models, e.g. a SARIMA (1,0,1)(1,0,1)[4] process. I installed the package 'forecast', where the function simulate.Arima should do what I am trying to do. I am not able to understand how it works Could somebody help me with an example? thank you Stefano Sofia

[R] how to divide data by week

2012-04-13 Thread Stefano Sofia
the years, from the 8th to the 14th of May, ..., from the 29th to the 31st of May, from the 1st to the 7th of July and so on). Is there an easy way to do that? Thank you for your help Stefano Sofia yearmonthday Freq 1 2004 51 3 2 2004

[R] Summary about how to divide data by week

2012-04-17 Thread Stefano Sofia
Thank you to Ozgur, who gave me the hints for an easy solution. There are the commands that work for my case: mean(my_dataframe$Freq[my_dataframe$month == 5 my_dataframe$day %in% c(1:7)]) mean(my_dataframe$Freq[my_dataframe$month == 5 my_dataframe$day %in% c(8:14)]) ... Stefano Sofia PhD

[R] plot a single frequency of a ts object

2013-11-06 Thread Stefano Sofia
both y1 and all the Winters of y2. I am not able to find an easy and straightforward way to do that. Could somebody please help me in this? Thank you Stefano Sofia AVVISO IMPORTANTE: Questo messaggio di posta elettronica può contenere informazioni confidenziali

[R] Ordering the rows of a data frame

2014-01-03 Thread Stefano Sofia
Dear R users, I have two files of seasonal rainfall data (more than 10,000 rows each); here the first 8 rows of each file are reported. Code_Raingouge,Y_init,M_init,D_init,h_init,m_init,Y_fin,M_fin,D_fin,h_fin,m_fin,Rainfall,N_Values,Quality_Level,Code_Station

[R] Use of different colours in plot

2014-07-18 Thread Stefano Sofia
? Thank you Stefano Sofia AVVISO IMPORTANTE: Questo messaggio di posta elettronica può contenere informazioni confidenziali, pertanto è destinato solo a persone autorizzate alla ricezione. I messaggi di posta elettronica per i client di Regione Marche

Re: [R] Use of different colours in plot

2014-07-18 Thread Stefano Sofia
Thank you Jim, perfect. Da: Jim Lemon [j...@bitwrit.com.au] Inviato: venerdì 18 luglio 2014 10.22 A: r-help@r-project.org Cc: Stefano Sofia Oggetto: Re: [R] Use of different colours in plot On Fri, 18 Jul 2014 07:07:04 AM Stefano Sofia wrote: Dear R list

[R] list of vectors which are part of an initial vector

2015-01-11 Thread Stefano Sofia
Dear list users, given for example the vector a - c(1:5), which is the easiest way to create a list of 5 vectors with three elements each apart from the head and the tail, like 1 2 1 2 3 2 3 4 3 4 5 4 5 ? I tried to use the split command, with no success. Could somebody show me hints for an

Re: [R] list of vectors which are part of an initial vector

2015-01-14 Thread Stefano Sofia
Thank you Jeff for your tips, I found what I was looking for. Stefano Da: Jeff Newmiller [jdnew...@dcn.davis.ca.us] Inviato: lunedì 12 gennaio 2015 9.13 A: Stefano Sofia; r-help@r-project.org Oggetto: Re: [R] list of vectors which are part of an initial

[R] create a vector from several data frames

2015-05-14 Thread Stefano Sofia
Dear r-users, suppose that I have 20 data frames df1, df2, ..., df20 (one for each different location) with the same column names and column types (the first column contains a date, the others are numeric) like day tmax tmin 2015-05-10 20 10 2015-05-11 21 12 2015-05-12 17 9 2015-05-13 24 13

Re: [R] create a vector from several data frames

2015-05-18 Thread Stefano Sofia
Thank you David. It is exactly what I was looking for and it works pefectly. Stefano Da: David L Carlson [dcarl...@tamu.edu] Inviato: giovedì 14 maggio 2015 17.18 A: Stefano Sofia; r-help@r-project.org Oggetto: RE: create a vector from several data frames

Re: [R] apply a function to a list of data frames

2015-05-26 Thread Stefano Sofia
Thank you for your help. Your explanations have been very useful. Stefano Da: Rui Barradas [ruipbarra...@sapo.pt] Inviato: venerdì 22 maggio 2015 20.26 A: Stefano Sofia; r-help@r-project.org Oggetto: Re: [R] apply a function to a list of data frames

[R] apply a function to a list of data frames

2015-05-22 Thread Stefano Sofia
Dear R-users, given a list of dataframes (like below reported), for each month I need to apply a function (called calc). The result should be written in a new list of data frames, one row for each month. I have been trying to use sapply, with no success. Could somebody help me in this? $df1

[R] How to change name of pdf output of function windRose in openair package

2015-11-05 Thread Stefano Sofia
Dear r-list users, I am using windRose within the openair package. Automatically the wind rose is saved in a pdf file called Rplots.pdf . I need to apply this function to different data frames, and each time I need to change automatically the name of the pdf output. I am not able to do it, I

Re: [R] How to change name of pdf output of function windRose in openair package

2015-11-07 Thread Stefano Sofia
Thanks to Jim and to Petr for their suggestion. Stefano Da: PIKAL Petr [petr.pi...@precheza.cz] Inviato: giovedì 5 novembre 2015 15.02 A: Stefano Sofia Cc: r-help@r-project.org Oggetto: RE: [R] How to change name of pdf output of function windRose

[R] how to divide a data frame of half-hourly wind observations into subset of three hours

2015-09-11 Thread Stefano Sofia
through output2_df <- output1_df$data output2_df$wd[output2_df$freqs == max(output2_df$freqs)]) Thank you for your attention and your help Stefano Sofia AVVISO IMPORTANTE: Questo messaggio di posta elettronica può contenere informazioni confidenziali, pertan

Re: [R] matrix which results singular but at the same time positive definite

2015-12-14 Thread Stefano Sofia
Dear John and dear Peter, I needed time to understand better some practical implications derived from your hints. Thank you Stefano Da: Fox, John [j...@mcmaster.ca] Inviato: giovedì 10 dicembre 2015 17.24 A: peter dalgaard; Stefano Sofia Cc: r-help@r

[R] matrix which results singular but at the same time positive definite

2015-12-10 Thread Stefano Sofia
Dear list users, through the "matrixcalc" package I am performing some checks of variance matrices (which must be positive definite). In this example, it happens that the matrix A here reported is singular but positive definite. Is it possible? [,1] [,2] [,3]

Re: [R] matrix which results singular but at the same time positive definite

2015-12-10 Thread Stefano Sofia
, John [j...@mcmaster.ca] Inviato: giovedì 10 dicembre 2015 14.41 A: Stefano Sofia; r-help@r-project.org Oggetto: RE: matrix which results singular but at the same time positive definite Dear Stefano, You've already had a couple of informative responses directly addressing your question

[R] Estimating MA parameters through arima or through package "dlm"

2016-01-04 Thread Stefano Sofia
Dear list users, I want to use apply a MA(2) process (x=beta1*epsilon_(t-1) + beta2*epsilon_(t-1) + epsilon_(t)) to a given time series (x), and I want to estimate the two parameters beta1, beta2 and the variance of the random variable epsilon_(t). If I use MA2_1 <- Arima(x, order=c(0,0,2)) I

Re: [R] matrix which results singular but at the same time positive definite

2015-12-28 Thread Stefano Sofia
Da: Paul Gilbert [pgilbert...@gmail.com] Inviato: martedì 15 dicembre 2015 15.28 A: Stefano Sofia Cc: r-help@r-project.org; Fox, John; peter dalgaard Oggetto: Re: [R] matrix which results singular but at the same time positive definite Stefano I think in other response to in this thread you got

[R] evaluate the daily mean with date in "POSIXct" "POSIXt" class

2016-06-07 Thread Stefano Sofia
ways in this direction, with no success. Is there an efficient way to do that? Could somebody give me an hint about it? Thank you for your attention and your help Stefano Sofia AVVISO IMPORTANTE: Questo messaggio di posta elettronica può contenere informazioni confid

[R] create an empty data frame and then fill in it

2016-06-09 Thread Stefano Sofia
Dear R list users, sorry for this simple question, but I already spent many efforts to solve it. I create an empty data frame called df_year like df_year <- data.frame(day=as.Date(character()), hs_MteBove=integer(), hs_MtePrata=integer(), hs_Pintura=integer(), hs_Pizzo=integer(),

Re: [R] evaluate the daily mean with date in "POSIXct" "POSIXt" class

2016-06-07 Thread Stefano Sofia
Thank you Jim, you gave me the right hint. Stefano Da: Jim Lemon [drjimle...@gmail.com] Inviato: martedì 7 giugno 2016 9.39 A: Stefano Sofia Cc: r-help@r-project.org Oggetto: Re: [R] evaluate the daily mean with date in "POSIXct" "POSIXt&quo

Re: [R] create an empty data frame and then fill in it (and then evaluate the mean of semi-hourly data for each day)

2016-06-10 Thread Stefano Sofia
ot work. I do not understand why the class of df_snow_day$snow is of type list either: day snow NA NULL NA.1 NULL NA.2 NULL Where is my mistake? Thank you for all your help Stefano _ Da: Duncan Murdoch [murdoch.dun...@gmail

[R] five multiple plots with ggplot

2016-02-07 Thread Stefano Sofia
Dear list users, I would like to have multiple plots in one page with ggplot, in particular five graphs: in the central plot the snow cover (hs) of two meteorological stations; above wind direction and temperature of one of the two stations and below wind direction and temperature of the other

[R] lapply on list of lists

2016-02-12 Thread Stefano Sofia
Dear R list users, I have three lists of data frames, respectively temp_list, wind_list and snow_list. The elements of these three lists are temp_list$station1, temp_list$station2 and temp_list$station3 with columns date and temp; wind_list$station1, wind_list$station2 and wind_list$station3

[R] filtering a data frame from a column of type integer

2016-02-15 Thread Stefano Sofia
Dear R list users, I am not able to perform a trivial filter of a data frame. From a txt file (df_file.txt) of this form: sensor_RM station_RM place_RM municipality_RM Y_init_RM M_init_RM D_init_RM Y_fin_RM M_fin_RM D_fin_RM goes_on notes sensor_RT station_RT net Omogneneous 2000 1510 Candelara

Re: [R] filtering a data frame from a column of type integer

2016-02-16 Thread Stefano Sofia
Thank you Stefano Da: Huzefa Khalil [huzefa.kha...@umich.edu] Inviato: luned� 15 febbraio 2016 17.52 A: Stefano Sofia Cc: r-help@r-project.org Oggetto: Re: [R] filtering a data frame from a column of type integer This is because of the presence of NA's in your

Re: [R] Query about use of format in strptime

2016-04-11 Thread Stefano Sofia
for example "20071119" and "20071121". I am not able to create a sequence of class "POSIXlt" "POSIXt", in order to merge the two data frames. Could you please help me in this? Thank you again for your attention Stefano _______

[R] Query about use of format in strptime

2016-04-11 Thread Stefano Sofia
Dear R-list users, I need to use strptime because I have to deal with date with hours and minutes. I read the manual for strptime and I also looked at many examples, but when I try to apply it to my code, I always encounter some problems. I try to change the default format, with no success. Why?

Re: [R] how to manage missing values correctly when importing a data frame

2016-09-07 Thread Stefano Sofia
missing data, rather than making # assumptions. Again, sorry for my question Stefano Da: Sarah Goslee [sarah.gos...@gmail.com] Inviato: mercoledì 7 settembre 2016 15.11 A: Stefano Sofia Cc: r-help@r-project.org Oggetto: Re: [R] how to manage missing values c

[R] how to manage missing values correctly when importing a data frame

2016-09-07 Thread Stefano Sofia
nt_RT [1] "numeric" $Lat_cent_RT [1] "numeric" $Quota_RT [1] "numeric" $Actual_net [1] "character" $Notes [1] "logical" $Test_20141231 [1] "character" $Test_20151231 [1] "character" I am struggling to understand why the query throu

[R] (no subject)

2016-09-12 Thread Stefano Sofia
ives > [1] "YES" > > while > print(Storia_RM_RT$Omogenea_20151231[Storia_RM_RT$Station_RT == 112]) gives > [1] NA "YES" > > > I am struggling to understand why the query through the field Station_RT does > not work. > Could please somebody

Re: [R] How to produce rainfall maps

2017-11-23 Thread Stefano Sofia
ugh for me) - ggplot should produce the map I need; but where are the options for the interpolation method? Again, any help will be appreciated. Stefano (oo) --oOO--( )--OOo-------- Stefano Sofia PhD Area Meteorologica e Area Nivologica - Centro Funzionale Servizio Protezione Civile

[R] How to produce rainfall maps

2017-11-17 Thread Stefano Sofia
= element_blank(), legend.position = �right�, legend.key = element_blank() ) (oo) --oOO--( )--OOo-------- Stefano Sofia PhD Area Meteorologica e Area nivologica - Centro Funzionale Servizio Protezione Civile - Regione Marche Via del Colle Ameno 5 60126 Torrette di Ancona, Ancona Uff: 071

[R] cumulate of snow cumulates from daily values of different automatic stations for some time intervals

2018-08-10 Thread Stefano Sofia
ection for an efficient solution? Thank you for your attention and your help Stefano (oo) --oOO--( )--OOo Stefano Sofia PhD Area Meteorologica e Area nivologica - Centro Funzionale Servizio Protezione Civile - Regione Marche Via del Colle Ameno 5 60126 Torrette d

Re: [R] cumulate of snow cumulates from daily values of different automatic stations for some time intervals

2018-08-16 Thread Stefano Sofia
]]) df_snow_totals <- data.frame("station_code" = c(217, 218, 219)) df_snow_totals$Cumulata <- as.vector(my_output) df_snow_totals$Cumulata <- as.numeric(as.character(unlist(df_snow_totals$Cumulata))) It works. Thank you for your help Stefano (oo) --oOO--

Re: [R] Sum of columns of a data frame equal to NA when all the elements are NA

2018-03-22 Thread Stefano Sofia
Thank you. Perfect solution. Stefano (oo) --oOO--( )--OOo Stefano Sofia PhD Area Meteorologica e Area nivologica - Centro Funzionale Servizio Protezione Civile - Regione Marche Via del Colle Ameno 5 60126 Torrette di Ancona, Ancona Uff: 071 806 7743 E-mail: stefano.so

[R] Sum of columns of a data frame equal to NA when all the elements are NA

2018-03-21 Thread Stefano Sofia
you for your help Stefano (oo) --oOO--( )--OOo Stefano Sofia PhD Area Meteorologica e Area nivologica - Centro Funzionale Servizio Protezione Civile - Regione Marche Via del Colle Ameno 5 60126 Torrette di Ancona, Ancona Uff: 071 806 7743 E-mail: stefano.so...@regione.

[R] transforming dates

2019-11-04 Thread Stefano Sofia
Hello. I am not sure if this hint might be useful, but I share it anyway: what about using the as.POSIXct command? as.POSIXct(mydate, format="%d-%m-%Y) or as.POSIXct(mydate, format="%d/%m/%Y) Hope this helps Stefano (oo) --oOO--( )--OOo-------- Stefano Sofia

Re: [R] nearest lower and higher integers to a multiple of another integer

2020-04-06 Thread Stefano Sofia
Thank you very much. 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

[R] nearest lower and higher integers to a multiple of another integer

2020-04-06 Thread Stefano Sofia
efficient at all. Could please somebody help me to find an easy way to implement it? Thank you for your attention and your help Stefano Sofia (oo) --oOO--( )--OOo-------- Stefano Sofia PhD Civil Protection - Marche Region Meteo Section Snow Section Via del Colle Ameno 5 60126 T

[R] Classification of wind events

2020-05-12 Thread Stefano Sofia
is costantly and strictly from the chosen direction. Does anybody have a clue on how to start to build this process in the right way? Thank you for your attention and your help Stefano (oo) --oOO--( )--OOo Stefano Sofia PhD Civil Protection - Marche Region Meteo Section Snow

Re: [R] Classification of wind events

2020-05-18 Thread Stefano Sofia
be taken into consideration only if within it the mean of max_speed is higher than 8.0 (which is speed in m/s). Could you please help me in this final step? Thank you again for all your help Stefano (oo) --oOO--( )--OOo Stefano Sofia PhD Civil Protection - Marche Region

Re: [R] Classification of wind events

2020-05-16 Thread Stefano Sofia
80, 5.60, 6.50, 6.60, 11.70, 11.30, 8.70, 7.10, 6.90, 4.30, 3.80, 4.30, 3.30, 2.30, 2.30, 3.20, 3.20, 2.90, 2.30, 1.50, 1.80, 2.90, 2.40, 1.80, 2.40, 2.30, 2.60, 1.80, 2.30, 1.90, 2.20, 2.80, 2.40, 1.00, 1.10, 1.60, 2.30, 2.50, 3.30, 3.40, 3.20, 4.50) Thank you for your attention Stefano

[R] Change the colours of some of the labels of the x-axis

2020-05-07 Thread Stefano Sofia
s"), trunc(as.POSIXct(last_day, format="%Y-%m-%d-%H-%M"), "days"), by="12 hours"), format="h%H-%d-%m-%y", pos=0) axis(side=2, at=seq(0, 15, 5)) (oo) --oOO--( )--OOo Stefano Sofia PhD Civil Protection - Marche Region Meteo Section

Re: [R] Change the colours of some of the labels of the x-axis

2020-05-09 Thread Stefano Sofia
Thank you very much. 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

Re: [R] how to create a sequence to consecutive values

2020-08-31 Thread Stefano Sofia
Thank you both of you. I am studying these solutions. 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

Re: [R] monthly mean for each month and each year in the data frame

2020-09-14 Thread Stefano Sofia
Yes, perfect. 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

[R] monthly mean for each month and each year in the data frame

2020-09-14 Thread Stefano Sofia
a.frame(data_POSIX=seq(first_day_2, last_day_2, by="1 days")) df2$value <- runif(nrow(df2), 0, 10) df <- rbind(df1, df2) (oo) --oOO--( )--OOo Stefano Sofia PhD Civil Protection - Marche Region Meteo Section Snow Section Vi

Re: [R] monthly mean for each month and each year in the data frame

2020-09-14 Thread Stefano Sofia
Thank you again. I finally used aggregate because it build a data frame straight away. 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

[R] how to create a sequence to consecutive values

2020-08-28 Thread Stefano Sofia
ult (0,0,0,1,1,1,1,0,0,0,0,2,2,0,3,3,3,0,0) I tried with ave, but no way to get it for me. 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-m

Re: [R] how to create a sequence to consecutive values

2020-08-28 Thread Stefano Sofia
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

Re: [R] aggregate semi-hourly data not 00-24 but 9-9

2020-09-22 Thread Stefano Sofia
Yes, thank you so much. 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

[R] merged data frame with

2020-09-29 Thread Stefano Sofia
10:30:00 23 2005-11-14 11:00:00 24 2005-11-14 11:30:00end 25 2005-11-14 12:00:00 Why there is instead of NA? And why df3$pch[df3$event == "start"] <- 24 gives a whole column of NA and not 24 at row 6? (oo) --oOO--( )--OOo Stefano Sofia Ph

[R] aggregate semi-hourly data not 00-24 but 9-9

2020-09-21 Thread Stefano Sofia
, tz="Etc/GMT-1") df1 <- data.frame(data_POSIX=seq(day_1, day_2, by="30 min")) df1$hs <- rnorm(nrows(df1), 40, 10) df1$diff[2:nrow(df1)] <- diff(df1$hs) df1$day <- format(df$data_POSIX,"%y-%m-%d") df2 <- aggregate(diff ~ day, df, sum) Thank you for your he

Re: [R] change frequency of wind data correctly

2020-12-06 Thread Stefano Sofia
u for your attention and 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

Re: [R] change frequency of wind data correctly

2020-12-06 Thread Stefano Sofia
. Also missing data might be easily handled, changing the "mean" function with a function that accepts NA. But I will study all the solutions that have been kindly proposed. Thank you all of you Stefano (oo) --oOO--( )--OOo-------- Stefano Sofia PhD Civil Protectio

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

[R] change frequency of wind data correctly

2020-12-02 Thread Stefano Sofia
-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 y

Re: [R] empty data frame and POSIXct data types

2021-06-24 Thread Stefano Sofia
of length 2. I thought that, once created an empty data frame, I could fit any vector without specifying the length since the beginning. Now I will think about it. Thank you Stefano (oo) --oOO--( )--OOo-- Stefano Sofia PhD Civil Protection - Marche Region

[R] empty data frame and POSIXct data types

2021-06-24 Thread Stefano Sofia
please give me the right hints? Thank you for your precious help Stefano (oo) --oOO--( )--OOo-- Stefano Sofia PhD Civil Protection - Marche Region - Italy Meteo Section Snow Section Via del Colle Ameno 5 60126 Torre

[R] local maxima positions in a vector with duplicated values

2021-03-26 Thread Stefano Sofia
er not to use additional packages. Thank you for your precious help Stefano (oo) --oOO--( )--OOo---------- Stefano Sofia PhD Civil Protection - Marche Region - Italy Meteo Section Snow Section Via del Colle Ameno 5 60126 Torrette di Ancona, Ancona (AN) Uff:

Re: [R] local maxima positions in a vector with duplicated values

2021-03-29 Thread Stefano Sofia
--oOO--( )--OOo---------- Stefano Sofia PhD Civil Protection - Marche Region - Italy Meteo Section Snow Section Via del Colle Ameno 5 60126 Torrette di Ancona, Ancona (AN) Uff: +39 071 806 7743 E-mail: stefano.so...@regione.marche.it

Re: [R] local maxima positions in a vector with duplicated values

2021-03-29 Thread Stefano Sofia
Thank you Bill, your tip solved everything. Stefano (oo) --oOO--( )--OOo-- Stefano Sofia PhD Civil Protection - Marche Region - Italy Meteo Section Snow Section Via del Colle Ameno 5 60126 Torrette di Ancona, Ancona (AN) Uff: +39 071 806 7743 E-mail

Re: [R] local maxima positions in a vector with duplicated values

2021-03-29 Thread Stefano Sofia
Maximum at the right endpoint is well accpted in both cases. If I am correst, I just append -Inf at the right end and then I apply what you wrote. Thank you. (oo) --oOO--( )--OOo-- Stefano Sofia PhD Civil Protection - Marche Region - Italy Meteo

[R] Managing NA values in aggregate

2021-09-04 Thread Stefano Sofia
o (oo) --oOO--( )--OOo---------- Stefano Sofia PhD Civil Protection - Marche Region - Italy Meteo Section Snow Section Via del Colle Ameno 5 60126 Torrette di Ancona, Ancona (AN) Uff: +39 071 806 7743 E-mail: stefano.so...@r

[R] Cumulates of snowfall within a given interval

2021-07-30 Thread Stefano Sofia
this is a single day; - f I choose a threshold of 100 cm in four days, I should get the 12th of February. (oo) --oOO--( )--OOo-- Stefano Sofia PhD Civil Protection - Marche Region - Italy Meteo Section Snow Section Via del Colle Ameno 5 60126 Torrette di Ancona

Re: [R] Cumulates of snowfall within a given interval

2021-07-30 Thread Stefano Sofia
Thank you Petr, simply perfect. Thank you again Stefano (oo) --oOO--( )--OOo-- Stefano Sofia PhD Civil Protection - Marche Region - Italy Meteo Section Snow Section Via del Colle Ameno 5 60126 Torrette di Ancona, Ancona (AN) Uff: +39 071 806 7743 E

[R] converting to POSIXct

2021-11-30 Thread Stefano Sofia
hank you for your support. Stefano (oo) --oOO--( )--OOo-- Stefano Sofia PhD Civil Protection - Marche Region - Italy Meteo Section Snow Section Via del Colle Ameno 5 60126 Torrette di Ancona, Ancona (AN) Uff: +39 071 806 7743

Re: [R] converting to POSIXct

2021-11-30 Thread Stefano Sofia
Thanks to all of you. Stefano (oo) --oOO--( )--OOo-- Stefano Sofia PhD Civil Protection - Marche Region - Italy Meteo Section Snow Section Via del Colle Ameno 5 60126 Torrette di Ancona, Ancona (AN) Uff: +39 071 806 7743 E-mail: stefano.so

  1   2   >