Questions tagged [as.date]

as.Date is an R function used to convert between character or numeric representations and objects of class "Date", representing calendar dates.

as.Date is an R function used to convert between character or numeric representations and objects of class "Date", representing calendar dates.

https://www.rdocumentation.org/packages/base/versions/3.3.2/topics/as.Date

349 questions
-1
votes
1 answer

Convert strange formate character date to date in R

I have a dataset Peil_1 with column "timestamp" representing the time "value" was measured. # A tibble: 175,350 x 5 Timestamp Value `Quality Code` `Absolute Value` `AV Quality Code`
-1
votes
2 answers

Subset a dataframe based on numerical values of a string inside a variable

I have a data frame which is a time series of meteorological measurement with monthly resolution from 1961 till 2018. I am interested in the variable that measures the monthly average temperature since I need the multi-annual average temperature for…
m_rub
  • 31
  • 6
-1
votes
1 answer

R code incorrectly writing date format to excel

im working in R to analyse some data and having trouble getting my output file (excel workbook) to correctly display the date in Aus format (DD/MM/YYYY). the input file is csv with sites and dates. I've checked the excel dates in the input file are…
CatN
  • 71
  • 7
-1
votes
1 answer

Select Time Data

I only want to select the data between 2015-1 and 2018-1. usefuldata1 <-usefuldata[usefuldata$zeit > "2014 - 12",] usefuldata2 <-usefuldata1[usefuldata1$zeit < "2018-2",] Bigger than 2014 works. However, smaller than 2018 does not. I get the same…
SIDI
  • 7
  • 3
-1
votes
2 answers

Getting NA when converting a column from char to date in a data_frame

I am getting NA when I am trying to convert the data type from character to date using as.Date. Below is my code. please let me know what am I doing wrong here. >stock_data=rbind(read_csv("BHELEQ.csv")) >class(stock_data$Date) [1]…
LOKE2707
  • 312
  • 1
  • 5
  • 19
-1
votes
1 answer

r - difficult to understand structure of empty columns filled with dates

I have a data frame with empty columns. I want to fill one row of that data frame with dates. x <- data.frame(a = 1:2, b = rep(NA, 2), c = rep(NA, 2)) mydates <- as.Date(c("2016-01-31", "2016-02-29")) x[1, c("b", "c")] <- mydates x str(x) My dates…
user3245256
  • 1,842
  • 4
  • 24
  • 51
-1
votes
1 answer

geom_smooth not appearing on ggplot

I am having a problem where geom_smooth() is not working on my ggplot. Based on previous posts, I have found that because my date variables are character vectors, the geom_smooth() is not working. I am trying to convert my dates from class character…
-1
votes
1 answer

How do I convert the below string as date-time in R?

I have the following character vector that contains date/time. I want to convert them to a date format and I tried the below methods : as.Date() and as.POSIXct() time <- c("Oct 01,2015 15:38:31 ", "Oct 05,2015 11:07:14", "Oct 11,2015 14:15:51 ",…
sunitprasad1
  • 768
  • 2
  • 12
  • 28
-1
votes
1 answer

as.date coercion in R

Hello, I cannot figure out where the problem is even after consulting the documentation for as.Date, although it must be a very silly thing. I have a character vector DD that contains dates: unique(DD) [1] NA "1999-01" "2013-08"…
Giuseppe
  • 518
  • 10
  • 22
-2
votes
1 answer

why do as.Date() not converting, a string values column from dataframe, to values as date type?

I am trying converting a column having values as character from Dataframe, to date values. But after converting the column values turned into 'NA'. Here is my code: library(rvest) library(dplyr) dvpact <-…
Sanky Ach
  • 333
  • 8
  • 23
-2
votes
2 answers

Convert YYYY-YY to Year(date)

I have a data frame with year column as financial year Year 2001-02 2002-03 2003-04 How can I convert this to as.Date keeping either the whole thing or just the second year i.e 2002,2003,2004. On converting with %Y, I inevitably get…
-2
votes
1 answer

using as.Date() to convert dates as factors give "NA"s for some results

I'm writing a script to get info from Baseball Reference web pages. The first time i wrote the code it worked fine and all the dates stored as factors were correctly parse to dates with the as.Date() function. Nevertheless, the a day later I ran the…
darh78
  • 162
  • 1
  • 11
-2
votes
2 answers

How to find difference in hours between dates in R

I have the following dataframe (DF1): Date Value 29/12/2014 8:00 24.940 29/12/2014 9:00 24.960 29/12/2014 11:00 25.020 I would like to add a new column for DF1$DIFF, where it contains the difference in values between each…
Avi
  • 2,247
  • 4
  • 30
  • 52
-2
votes
1 answer

convert into date with R

> date<-as.character(date) > head(date) [1] "14-Jan" "14-Jan" "14-Jan" "14-Jan" "14-Jan" "14-Jan" > date1<-as.Date(date,format="%y-%b") > head(date1) [1] NA NA NA NA NA NA I wanna convert the date into date format so that i can make a extensible…
user3566160
  • 21
  • 2
  • 5
-3
votes
2 answers

Convert Character to Date with R

I have a Dataset with a column date having following values > class(daten$TIME) #[1] "character" head(daten$TIME) #[1] "1999M01" "1999M02" "1999M03" "1999M04" "1999M05" "1999M06" I would like to convert it to Date Format. I tried following code…
lp_ostri
  • 13
  • 2
1 2 3
23
24