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
0
votes
0 answers

Converting character string into Date

I have a character vector with timestamps like the following: Date <- c("Jul 31, 2017", "Jul 30, 2017", "Jul 29, 2017", "Jul 28, 2017") And I'm trying to convert it into a date object type. I have tried several methods: as.Date Date <-…
rubengura
  • 459
  • 1
  • 3
  • 18
0
votes
1 answer

How can I find the difference between two dates in the factor?

I have a data frame named "enrolments": enrolled_at, unenrolled_at and fully_participated_at are factors. I want to add a new column to my data frame that indicates the differences in hours between two non-empty attributes. The type of this new…
Yunus YILDIRIM
  • 91
  • 1
  • 13
0
votes
2 answers

Why filter ( as.Date(opp_date) == Sys.Date() ) is bringing yesterday's data?

I love using dplyr; I use it for everything. But, the problem I'm experimenting today is the following: I'm trying to simply filter all rows fromm my opps table where opp_date is from today. So, when I use filter(opps, as.Date(opp_date) ==…
Bernardo
  • 461
  • 7
  • 20
0
votes
1 answer

R Integration in HANA, Date

I am trying to integrate an R-Script in HANA and for this, I am getting some dataframes from HANA sent to my R-Script to work with it. Problem hereby is, that i can't read the Dataframe correctly and I don't know why. I am getting an factor, which…
0
votes
2 answers

R Error trying to use as.Date in a %>%

I recently learned about the piping operator %>% and I'm trying to incorporate into some of the projects I've been working on. I receive an error though when I try to use as.Date in the pipe. Example numbers <- c(1, 2, 3, 4, 5) dates <-…
user6609539
0
votes
2 answers

as.date function returns NA values from google.finance time series (eg. 19-01-17)

I've got this dataframe from google.finance and I want the "Date" column to be in date format. `read.csv("ual.csv", header = TRUE, stringsAsFactors = FALSE)? head(Ual_df) Date Open High Low Close Volume 1 19-May-17 76.42 78.34 76.18…
27titanik
  • 21
  • 5
0
votes
1 answer

Is it possible to change the timezone component of POSIXct dates?

I have a series of dates stored in class = c("POSIXct", "POSIXt"). Some of these dates cross the UK clock changes, resulting in different timezones for consecutive days, which causes problems when calculating days between dates e.g. the clock change…
ChrisP
  • 119
  • 1
  • 8
0
votes
1 answer

as.date recieved NA in R data.frame

Please help me to transform characters to date format as.date and strptime don't work... c <- data.frame(id = c('1', '2', '3', '4'), Date = c("01-Feb-16","03-May-15","24-Oct-14","20-Oct-12")) c$Date <- as.character(c$Date) str(c) then I'm trying…
Denis
  • 159
  • 2
  • 4
  • 17
0
votes
3 answers

Combining date and time columns into dd/mm/yyyy hh:mm

New to R and R studio. I have imported a dataset with the date and time in five seperate columns headed: YYYY MM DD hh mm How do I combine these into a single date column of the format dd/mm/yyyy hh:mm? Dataset:
LauraKate
  • 39
  • 1
  • 2
  • 5
0
votes
1 answer

Day-Month versus year plot in R

I have a csv file containing the following lines: V1 V2 1979 05/11/1979 1980 06/14/1980 1981 06/22/1981 1982 06/02/1982 1983 05/21/1983 I need to plot this as Day-Month in the Y-axis and Year in the X-axis I tried to do the…
Lyndz
  • 347
  • 1
  • 13
  • 30
0
votes
1 answer

R date.frame show date format not as it has been set

Goodmorning everybody! I'm struggling a bit with R and the good book R IN ACTION: Data analysis and graphics with R. Searching the web hasn't resulted in any valuable effort, and neither reading the 'man' page for as.Date. PROBLEM I've this input in…
Marc
  • 3
  • 1
0
votes
1 answer

r as.Date switching my year and month

I have a character string that is a date (month, day, year). char <- "12/1/2014" When I try to turn this character string into a date, and I specify month,day, year date <- as.Date(char, origin = "%m/%d/%Y") it formats it like I put in year, day,…
Jacob Curtis
  • 788
  • 1
  • 8
  • 22
0
votes
1 answer

Convert numeric values of a data table to dates

I want to convert a data table containing numeric values for 305 variables and 361 observations into a data table of same size containing dates. The data table does contain "NA"s. The numeric value of the dates has the origin of excel. This is what…
Tobi1990
  • 105
  • 1
  • 10
0
votes
2 answers

Column name in data frame goes back to numeric

Hi I'm trying to load some dates as column names of my data frame but they will only appear as numbers (11595 for example) even if I'm forcing them with as.Date Is there another way to do this? Thanks! dates <- seq(as.Date("2000-1-1"),…
lapioche75
  • 87
  • 1
  • 2
  • 9
0
votes
1 answer

Read in dates with as.Date from character %d%b%Y

This works: as.Date("22JAN2010", format="%d%b%Y") >"2010-01-22" This doesn't: as.Date("22MAR2010", format="%d%b%Y") >NA It breaks on MAR, MAY, OCT and works for JAN, FEB, APR, JUN, JUL, AUG, SEP, NOV, DEC. Coincidentally, my Windows 7 OS language…
DaReal
  • 597
  • 3
  • 10
  • 24