It reads other formats _if you specify them_. After all, no computer (or human)
can tell whether 11/03/1959 is November 3 or March 11 without further hinting.
So it tries the two ISO-like formats and leaves other cases for the user.
-pd
> On 20 Nov 2021, at 21:22 , Philip Monk wrote:
>
> Than
see if the data
is what you expect or alter it to be what you need.
-Original Message-
From: R-help On Behalf Of Philip Monk
Sent: Saturday, November 20, 2021 3:28 PM
To: Jeff Newmiller
Cc: R-help Mailing List
Subject: Re: [R] Date read correctly from CSV, then reformatted incorr
Richard,
This response was awe-inspiring. Thank you.
-Original Message-
From: R-help On Behalf Of Richard O'Keefe
Sent: Sunday, November 21, 2021 8:55 PM
To: Philip Monk
Cc: R Project Help
Subject: Re: [R] Date read correctly from CSV, then reformatted incorrectly
by R
CSV da
CSV data is very often strangely laid out. For analysis,
Buffer Date Reading
100... ...
100... ...
and so on is more like what a data frame should be. I get
quite annoyed when I finally manage to extract data from a
government agency only to find that my tax money has been
spent on maki
that may also mean sanity checks along the way to see if the data
is what you expect or alter it to be what you need.
-Original Message-
From: R-help On Behalf Of Philip Monk
Sent: Saturday, November 20, 2021 3:28 PM
To: Jeff Newmiller
Cc: R-help Mailing List
Subject: Re: [R] Date
I am. Long day, poorly small children!
P
On Sat, 20 Nov 2021, 21:08 Bert Gunter, wrote:
> "I also know that '/' is a special character in R (if that's the right
> term) "
>
> That is false. I think you are confusing "/" with "\", which is R's
> *escape* character.
>
> > cat("a/nb")
> a/nb
> >
"I also know that '/' is a special character in R (if that's the right term) "
That is false. I think you are confusing "/" with "\", which is R's
*escape* character.
> cat("a/nb")
a/nb
> cat("a\nb")
a
b
It gets confusing especially in regex's, because "\" is used in regex
syntax also.
Bert Gun
Thanks, Jeff.
I follow what you're doing below, but know I need to read up on Date /
POSIXct. Helpful direction! :)
On Sat, 20 Nov 2021 at 18:41, Jeff Newmiller wrote:
>
> Beat me to it! But it is also worth noting that once converted to Date or
> POSIXct, timestamps should be treated as data
Thanks, Andrew. I didn't realise as.Date *only* read two formats, I
think I was tripped up by using %y instead of %Y, though I also know
that '/' is a special character in R (if that's the right term) and as
such know there is special syntax to use (which I don't know).
On Sat, 20 Nov 2021 at 18:
Beat me to it! But it is also worth noting that once converted to Date or
POSIXct, timestamps should be treated as data without regard to how that data
is displayed. When you choose to output that data you will have options as to
the display format associated with the function you are using for
The as.Date function for a character class argument will try reading in two
formats (%Y-%m-%d and %Y/%m/%d).
This does not look like the format you have provided, which is why it
doesn't work. Try something like:
x <- c("28/10/2016", "19/11/2016", "31/12/2016", "16/01/2016", "05/03/2017")
as.Da
Thanks Eric & Jeff.
I'll certainly read up on lubridate, and the posting guide (again)
(this should be in plain text).
CSV extract below...
Philip
Buffer28/10/201619/11/201631/12/201616/01/201705/03/2017
1002.437110889-8.696748953.2392998162.4431833042.34
a) R data frames are column oriented. Do not fight this.
b) Data frame header names are character type. Period. Do not fight this.
It sounds like you need to reshape your data after you read it in. Provide the
first five lines of your CSV file (or a reasonable facsimile if your data are
confide
Hi Philip,
This is a recurring question and there are many ways to do this.
My preference is to use the lubridate package.
library(lubridate)
a <- "15/01/2010"
b <- dmy(a)
b
# "2010-01-15"
class(b)
# [1] "Date"
HTH,
Eric
On Sat, Nov 20, 2021 at 7:09 PM Philip Monk wrote:
> Hello,
>
> Simple b
Hello,
Simple but infuriating problem.
Reading in CSV of data using :
```
# CSV file has column headers with date of scene capture in format
dd/mm/
# check.names = FALSE averts R incorrectly processing dates due to '/'
data <- read.csv("C:/R_data/Bungala (b2000) julian.csv", check.names =
FA
15 matches
Mail list logo