Re: [R] Calculate daily means from 5-minute interval data

2021-08-29 Thread Jeff Newmiller
IMO assuming periodicity is a bad practice for this. Missing timestamps happen too, and there is no reason to build a broken analysis process. On August 29, 2021 7:09:01 PM PDT, Richard O'Keefe wrote: >Why would you need a package for this? >> samples.per.day <- 12*24 > >That's 12 5-minute inter

Re: [R] Calculate daily means from 5-minute interval data

2021-08-29 Thread Richard O'Keefe
Why would you need a package for this? > samples.per.day <- 12*24 That's 12 5-minute intervals per hour and 24 hours per day. Generate some fake data. > x <- rnorm(samples.per.day * 365) > length(x) [1] 105120 Reshape the fake data into a matrix where each row represents one 24-hour period. > m

Re: [R] A glitch (???) in tools::texi2pf.

2021-08-29 Thread Achim Zeileis
On Sat, 28 Aug 2021, Rolf Turner wrote: On Sat, 28 Aug 2021 12:49:04 +0300 Eric Berger wrote: As Achim wrote in point (2), Makefile is your friend. Well, all I can say is that Makefile is *not* my friend; I have never made its acquaintance and wouldn't know where to begin looking. Would i

Re: [R] Upgraded to 4.1.1 assignment operator keys not working [RESOLVED]

2021-08-29 Thread Rich Shepard
On Sun, 29 Aug 2021, Rich Shepard wrote: But, ... help. Sigh. It helps to start ESS in emacs first. Rich __ 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 gu

[R] Upgraded to 4.1.1 assignment operator keys not working

2021-08-29 Thread Rich Shepard
Just upgraded to R-4.1.1-x86_64-1_SBo on Slackware-14.2/x86_64. While it's been a while since I last ran R trying 'Alt + -' to enter the assignment monitor is not working. Assuming the problem is with me I'm not finding what I'm doing incorrectly in all the docs I searched and I'm suitably embarra

Re: [R] Calculate daily means from 5-minute interval data

2021-08-29 Thread Rich Shepard
On Sun, 29 Aug 2021, Andrew Simmons wrote: I would suggest something like: Thanks, Andrew. Stay well, Rich __ 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

Re: [R] Calculate daily means from 5-minute interval data

2021-08-29 Thread Rich Shepard
On Sun, 29 Aug 2021, Rui Barradas wrote: Hope this helps, Rui, Greatly! I'll study it carefully so I fully understand the process. Many thanks. Stay well, Rich __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.eth

Re: [R] Calculate daily means from 5-minute interval data

2021-08-29 Thread Rui Barradas
Hello, I forgot in my previous answer, sorry for the duplicated mails. The function in my previous mail has a na.rm argument, defaulting to FALSE, pass na.rm = TRUE to remove the NA's. agg <- aggregate(cfs ~ date, df1, fun, na.rm = TRUE) Or simply change the default. I prefer to set na.rm

Re: [R] Calculate daily means from 5-minute interval data

2021-08-29 Thread Rich Shepard
On Sun, 29 Aug 2021, Jeff Newmiller wrote: You may find something useful on handling timestamp data here: https://jdnewmil.github.io/ Jeff, I'll certainly read those articles. Many thanks, Rich __ R-help@r-project.org mailing list -- To UNSUBSCRI

Re: [R] Calculate daily means from 5-minute interval data

2021-08-29 Thread Rui Barradas
Hello, You have date and hour in two separate columns, so to compute daily stats part of the work is already done. (Were they in the same column you would have to extract the date only.) # convert to class "Date" df1$date <- as.Date(df1$date) # function to compute the stats required # it's

Re: [R] Calculate daily means from 5-minute interval data

2021-08-29 Thread Andrew Simmons
Hello, I would suggest something like: date <- seq(as.Date("2020-01-01"), as.Date("2020-12-31"), 1) time <- sprintf("%02d:%02d", rep(0:23, each = 12), seq.int(0, 55, 5)) x <- data.frame( date = rep(date, each = length(time)), time = time ) x$cfs <- stats::rnorm(nrow(x)) cols2aggregate

Re: [R] Calculate daily means from 5-minute interval data

2021-08-29 Thread Rich Shepard
On Sun, 29 Aug 2021, Rui Barradas wrote: I forgot in my previous answer, sorry for the duplicated mails. The function in my previous mail has a na.rm argument, defaulting to FALSE, pass na.rm = TRUE to remove the NA's. agg <- aggregate(cfs ~ date, df1, fun, na.rm = TRUE) Or simply change the

Re: [R] Calculate daily means from 5-minute interval data

2021-08-29 Thread Jeff Newmiller
You may find something useful on handling timestamp data here: https://jdnewmil.github.io/ On August 29, 2021 9:23:31 AM PDT, Jeff Newmiller wrote: >The general idea is to create a "grouping" column with repeated values for >each day, and then to use aggregate to compute your combined results.

Re: [R] Calculate daily means from 5-minute interval data

2021-08-29 Thread Rich Shepard
On Sun, 29 Aug 2021, Jeff Newmiller wrote: The general idea is to create a "grouping" column with repeated values for each day, and then to use aggregate to compute your combined results. The dplyr package's group_by/summarise functions can also do this, and there are also proponents of the data

Re: [R] Calculate daily means from 5-minute interval data

2021-08-29 Thread Rich Shepard
On Sun, 29 Aug 2021, Eric Berger wrote: Provide dummy data (e.g. 5-10 lines), say like the contents of a csv file, and calculate by hand what you'd like to see in the plot. (And describe what the plot would look like.) Eric, Mea culpa! I extracted a set of sample data and forgot to include it

Re: [R] Calculate daily means from 5-minute interval data

2021-08-29 Thread Jeff Newmiller
The general idea is to create a "grouping" column with repeated values for each day, and then to use aggregate to compute your combined results. The dplyr package's group_by/summarise functions can also do this, and there are also proponents of the data.table package which is high performance bu

Re: [R] Calculate daily means from 5-minute interval data

2021-08-29 Thread Eric Berger
Hi Rich, Your request is a bit open-ended but here's a suggestion that might help get you an answer. Provide dummy data (e.g. 5-10 lines), say like the contents of a csv file, and calculate by hand what you'd like to see in the plot. (And describe what the plot would look like.) It sounds like what

[R] Calculate daily means from 5-minute interval data

2021-08-29 Thread Rich Shepard
I have a year's hydraulic data (discharge, stage height, velocity, etc.) from a USGS monitoring gauge recording values every 5 minutes. The data files contain 90K-93K lines and plotting all these data would produce a solid block of color. What I want are the daily means and standard deviation fro

Re: [R] Finding if numbers fall within a range

2021-08-29 Thread Eliza Botto
Thanks Jeff, It worked!! From: Jeff Newmiller Sent: Saturday 28 August 2021 16:32 To: r-help@r-project.org ; Eliza Botto ; r-help@r-project.org Subject: Re: [R] Finding if numbers fall within a range You messed up the dput somehow... but I think this works: m <

Re: [R] coercion to an object...

2021-08-29 Thread akshay kulkarni
dear Duncun, Thanks a lot... From: Duncan Murdoch Sent: Sunday, August 29, 2021 5:49 PM To: akshay kulkarni ; Enrico Schumann Cc: R help Mailing list ; r-help-requ...@r-project.org Subject: Re: [R] coercion to an object... On 29/08/

Re: [R] coercion to an object...

2021-08-29 Thread Duncan Murdoch
On 29/08/2021 7:52 a.m., akshay kulkarni wrote: dear Enrico, it works. Thanks a lot. I spent over an hour looking for this function in the web, but was bootless. Do you have any way to get functions where you are given what it has to do? The most common case is that you

Re: [R] ggplot geom_line problem

2021-08-29 Thread phil
Thank you Jeff. This solves my problem. On 2021-08-28 21:54, Jeff Newmiller wrote: Maybe you will find that coord_cartesian( ylim=c(-30,30) ) works better since it doesn't filter out data before rendering. On August 28, 2021 6:45:11 PM PDT, p...@philipsmith.ca wrote: I am preparing a time serie

Re: [R] coercion to an object...

2021-08-29 Thread akshay kulkarni
dear Enrico, it works. Thanks a lot. I spent over an hour looking for this function in the web, but was bootless. Do you have any way to get functions where you are given what it has to do? The most common case is that you are given a list of functions, but they number to

Re: [R] coercion to an object...

2021-08-29 Thread Enrico Schumann
On Sun, 29 Aug 2021, akshay kulkarni writes: > Dear members, > I think the following question is rudimentary, > but I couldn't find an answer in the Internet. > > Suppose there is an object A, and ls() lists it as "A". How do you convert > this character object to th

[R] coercion to an object...

2021-08-29 Thread akshay kulkarni
Dear members, I think the following question is rudimentary, but I couldn't find an answer in the Internet. Suppose there is an object A, and ls() lists it as "A". How do you convert this character object to the object A. i.e I want a function f such that class(f("A

Re: [R] A glitch (???) in tools::texi2pf.

2021-08-29 Thread Richard O'Keefe
It is a general "feature" of TeX that documents with tables of contents, indices, bibliographies, and so on, have to be "iterated to convergence". A couple of PhD theses came out of Stanford; the problem is in that which page one thing goes on depends on where other things went, which depends on w