1
I would like to know how to make averages of various intervals, minimum and maximum daily and monthly of a time series of a file that has two columns (date and temperature value), but the date is in the following format yyyy-MM-dd HH:mm ss:.
I read some questions/answers here and I was totally confused, sorry, I’m new to R. I installed several programs (xts, zoo, lubridate).
I ran a time series like this:
st <- ts(CEM_1$Temp, start = 2017, frequency = 48)
But I can’t decompose on daily or monthly averages, nor understand if the file is reading right.
head(CEM_1)
# A tibble: 6 x 2
Data Temp
<date> <dbl>
1 2017-04-18 25.4
2 2017-04-18 24.9
3 2017-04-18 24.8
4 2017-04-18 27.3
5 2017-04-18 26.0
6 2017-04-18 24.8
And how to make the graphs "to see better" this data?
Welcome to Stackoverflow! Unfortunately, this question cannot be reproduced by anyone trying to answer it. Please, take a look at this link and see how to ask a reproducible question in R. So, people who wish to help you will be able to do this in the best possible way.
– Marcus Nunes
The question is very general, but before it closes,
agg <- aggregate(Temp ~ Data, CEM_1, mean, na.rm = TRUE)
. Afterward,library(ggplot2); ggplot(agg, aes(x = Data, y = Temp)) + geom_line()
.– Rui Barradas
Perfect, came out a general chart of temperatures all over time, and now how to make daily, monthly, annual averages??? I’ll paste the script as it is so far, okay? Thanks for the help I’m trying to understand how the community works!!!
– Ana Cristina Monteiro-Leonel
#opening Excel library(readxl) > temperature <- read_excel("PELD/sheets/CEM_1.xlsx", + col_types = c("date", "Numeric")) > View(CEM_1) > #Opening package to generate time series! library(lubridate) st <- ts(CEM_1$Temp, start = 2017, Frequency = 48) Agg <- Aggregate(Temp ~ Date, CEM_1, Mean, na.rm = TRUE) #After, library(plotgg2) ggplot(Agg, aes(x = Date, y = Temp)) + geom_line()
– Ana Cristina Monteiro-Leonel
Link to the chart: https://drive.google.com/file/d/1JXe1KmHd-QhUYDFLT-JLVUXVkZlP8e2V/view?usp=sharing
– Ana Cristina Monteiro-Leonel
Link to the spreadsheet: https://drive.google.com/file/d/1lO7z-G-cmUB6K50AsDLOaf2wyDsjioj/view?usp=sharing
– Ana Cristina Monteiro-Leonel
See if the answer is as you wish.
– Rui Barradas