Hi all,
Thank you very much.
I learn a lot from your suggested solution.
On Sun, Nov 5, 2023 at 12:56 AM Rui Barradas wrote:
> Às 01:49 de 03/11/2023, roslinazairimah zakaria escreveu:
> > Hi all,
> >
> > This is the data:
> >
> >> dput(head(dt1,20))structure(list(StationName = c("PALO ALTO CA
discussing whether, especially for larger data sets, there are ways that
could be more efficient.
-Original Message-
From: R-help On Behalf Of Rui Barradas
Sent: Saturday, November 4, 2023 12:56 PM
To: roslinazairimah zakaria ; jim holtman
Cc: r-help mailing list
Subject: Re: [R] Sum data ac
Às 01:49 de 03/11/2023, roslinazairimah zakaria escreveu:
Hi all,
This is the data:
dput(head(dt1,20))structure(list(StationName = c("PALO ALTO CA / CAMBRIDGE #1",
"PALO ALTO CA / CAMBRIDGE #1", "PALO ALTO CA / CAMBRIDGE #1",
"PALO ALTO CA / CAMBRIDGE #1", "PALO ALTO CA / CAMBRIDGE #1",
"PALO
Hi Jim,
Yes, that is exactly what I am trying to do. Once I get that, I want to
plot time series data.
Thank you very much Jim.
On Fri, Nov 3, 2023 at 11:58 PM jim holtman wrote:
> Is this what you are after?
>
> library(tidyverse)
>
>
> library(lubridate)
>
> input <- structure(list(StationNam
Is this what you are after?
library(tidyverse)
library(lubridate)
input <- structure(list(StationName = c("PALO ALTO CA / CAMBRIDGE #1",
"PALO ALTO CA / CAMBRIDGE #1", "PALO ALTO CA / CAMBRIDGE #1",
"PALO ALTO CA / CAMBRIDGE #1", "PALO ALTO CA / CAMBRIDGE #1",
"PALO ALTO CA / CAMBRIDGE #1
Cbind is not a very good tool for adding columns to a data frame. Either use
explicit column referencing like
dt1$x <- new_data_vector
but you do have to make sure the new data vector has the same number of values
and in the same order as the other data in dt1. The transition from multiple
rec
Hi,
I tried this:
# extract date from the time stamp
dt1 <- cbind(as.Date(dt$EndDate, format="%m/%d/%Y"), dt$EnergykWh)
head(dt1)
colnames(dt1) <- c("date", "EnergykWh")
and
my dt1 becomes these, the dates are replace by numbers.
dt1 <- cbind(as.Date(dt$EndDate, format="%m/%d/%Y"), dt$EnergykWh)
d
Thank you very much for your help. It is very much appreciated.
On Fri, Nov 3, 2023 at 7:23 AM roslinazairimah zakaria
wrote:
> Dear all,
>
> I have this set of data. I would like to sum the EnergykWh according date
> sequences.
>
> > head(dt1,20) StationName date time En
Hi all,
This is the data:
> dput(head(dt1,20))structure(list(StationName = c("PALO ALTO CA / CAMBRIDGE
> #1",
"PALO ALTO CA / CAMBRIDGE #1", "PALO ALTO CA / CAMBRIDGE #1",
"PALO ALTO CA / CAMBRIDGE #1", "PALO ALTO CA / CAMBRIDGE #1",
"PALO ALTO CA / CAMBRIDGE #1", "PALO ALTO CA / CAMBRIDGE #1",
How about send a 'dput' of some sample data. My guess is that your date is
'character' and not 'Date'.
Thanks
Jim Holtman
*Data Munger Guru*
*What is the problem that you are trying to solve?Tell me what you want to
do, not how you want to do it.*
On Thu, Nov 2, 2023 at 4:24 PM roslinazairim
date appears to be a character variable, and R is treating it as such.
str(dt1)
might give you some insight. Or the dplyr equivalent
glimpse(dt1)
I think R did what you asked, but if you want to be able to order
records by date, in temporal order, you need to tell R that it is a date:
library
11 matches
Mail list logo