I use check.names=FALSE more often than not, and I almost never end up changing
them "anyway". Back-ticks as quotes are very effective at allowing unusual
column names to be used in R code. (The only exception I have to this is when
programatically building formulas the eval step gets quite conv
On 10/25/2021 7:09 AM, Philip Monk wrote:
Hello,
First post - apologies if I get anything wrong - either in describing the
question (I've only been using R for a week) or etiquette.
I have CSV files of Land Surface Temperature (LST) data derived from
Landsat 8 data and exported from Google Eart
You did not say which function you used to import the csv file, but it looks
like you probably used read.csv without setting the check.names argument to
FALSE.
Whether you change that out not, once you have reshaped the data, you can use a
format specifier with as.Date to extract a date. (See ?
Well, both newbies and oldies need to read and follow the Help files
carefully. In this case, note the "check.names" argument of ?read.csv. You
need to set it to FALSE in your (omitted) read.csv call, because your
strings are not syntactically valid names (follow the "make.names" link to
learn wha
Hi Keith,
Perhaps you do not want to go with calendar weeks:
365/7 = 52.14
as there are not an even number of weeks in a year, you may want to
plot by week from your initial observation. As you are using as.Date,
you could simply calculate weeks as:
data$Week<-1+as.numeric(data$Date - data$Date[
"Date" means "numeric with an attribute of class='Date' ", so what actually
happened was that the for loop dropped the class attribute. In most cases using
the seq_along() function lets you step through index values to extract values
from your original vectors. In general, any S3 object will beh
tro
> manual.
>
> Cheers
> Petr
>
> > -Original Message-
> > From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of David
> > Winsemius
> > Sent: Friday, January 6, 2017 6:13 AM
> > To: elif beyza çatalbaş
> > Cc: r-help@r-project.org
&
t; Winsemius
> Sent: Friday, January 6, 2017 6:13 AM
> To: elif beyza çatalbaş
> Cc: r-help@r-project.org
> Subject: Re: [R] Dates and Times in R
>
> You should read the Posting Guide.
>
> > On Jan 5, 2017, at 10:56 AM, elif beyza çatalbaş
> wrote:
> >
> > Dea
You should read the Posting Guide.
> On Jan 5, 2017, at 10:56 AM, elif beyza çatalbaş
> wrote:
>
> Dear Mrs/Mr
>
> I am a meteorological engineer and currently I am a master of science
> student in atmospheric science at Istanbul Technical University. I have
> data analysis and visualization l
Hello,
Your attachment didn't come through, save the file in the csv format
and name it *.txt.
Moreover, you ask what is wrong with your syntax, but what syntax?
What is your code? Post a minimal example of what you are trying if
you want answers from us.
In the mean time at an R pormpt tr
Thanks.
-Original Message-
From: David L Carlson [mailto:dcarl...@tamu.edu]
Sent: 13 July 2016 05:05 PM
To: Mangalani Peter Makananisa; r-help@r-project.org
Subject: RE: Dates in R (Year Month)
You need to look at the examples on the manual pages for ?yearmon and ?strptime:
> Z <- as.ye
You need to look at the examples on the manual pages for ?yearmon and ?strptime:
> Z <- as.yearmon(as.character(X), "%Y%m")
> Z
[1] "Jan 2015" "Feb 2015" "Mar 2015" "May 2015" "Jun 2015" "Jul 2015" "Aug
2015"
[8] "Sep 2015" "Oct 2015" "Nov 2015" "Dec 2015" "Jan 2016" "Feb 2016" "Mar
2016"
[15]
You can not convert numeric vectors directly to yearmon object. You must
convert the X variable to character and add “-“ between year and month. Then
as.yearmon function will work properly.
Please, read help pages of ?as.character, ?strptime and ?as.yearmon.
Example:
> library(zoo)
> aaa <- as
> On Feb 8, 2016, at 12:45 PM, Göran Broström wrote:
>
> Thanks Marc, but see below!
>
> On 2016-02-08 19:26, Marc Schwartz wrote:
>>
>>> On Feb 8, 2016, at 11:26 AM, Göran Broström wrote:
>>>
>>> I have a data frame with dates as integers:
>>>
summary(persons[, c("foddat", "doddat")])
Thanks Marc, but see below!
On 2016-02-08 19:26, Marc Schwartz wrote:
On Feb 8, 2016, at 11:26 AM, Göran Broström wrote:
I have a data frame with dates as integers:
summary(persons[, c("foddat", "doddat")])
foddat doddat
Min. :1679 Min. :1800
1st Qu.:1876090
> On Feb 8, 2016, at 11:26 AM, Göran Broström wrote:
>
> I have a data frame with dates as integers:
>
> > summary(persons[, c("foddat", "doddat")])
> foddat doddat
> Min. :1679 Min. :1800
> 1st Qu.:18760904 1st Qu.:18810924
> Median :19030426 Median :19091227
Hi,
I think it is due to the missing values:
I get warnings()
z.5.annualMax<- daily2annual(z, FUN=max, na.rm=TRUE,dates=1)
#There were 50 or more warnings (use warnings() to see the first 50)
write.csv(z.5max.annual, file = "Stations.csv")
Just to validate the result:
I tried this:
res3<- lap
Hi,
Try this:
lstf1<- list.files(pattern=".txt")
length(lstf1)
#[1] 119
#I changed the function a little bit to unlist by rows to match the dates
column I created.
fun2<- function(lstf){
lst1<-lapply(lstf,function(x) readLines(x))
lst2<-lapply(lst1,function(x) {gsub("(\\d+)(-.99)","\\1 \\2"
Hi Atem,
No problem.
which(res==-.99)
# [1] 18246 397379 420059 426569 427109 603659 604199 662518 664678
#[10] 698982 699522 700062 701142 754745 1289823 1500490 1589487 1716011
#[19] 1837083
which(res==-.99,arr.ind=TRUE)
# row col
#1506 1506 2
#12359 12359 2
Hi,
Try this:
lstf1<- list.files(pattern=".txt")
length(lstf1)
#[1] 119
fun2<- function(lstf){
lst1<-lapply(lstf,function(x) readLines(x))
lst2<-lapply(lst1,function(x) {gsub("(\\d+)(-.99)","\\1 \\2",x)})
lst3<-lapply(lst2,function(x) {x<-gsub("(\\d+)(-.99)","\\1 \\2",x)})
lst4<- lapply
Hi A.K,
I go an error on line 24 when processing all the 100 files:
res<-fun1(lstf1)
Error in read.table(x, sep = "", header = TRUE, stringsAsFactors = FALSE) :
more columns than column names
There seem to be a difference between lstf and lstf1.
Thanks,
Atem.
___
Hi,
Forgot that you wanted the result in a data.frame
fun1<- function(lstf){
lst1<-lapply(lstf,function(x)
read.table(x,sep="",header=TRUE,stringsAsFactors=FALSE))
lst2<- lapply(lst1,function(x) x[x$V1>=1961 & x$V1<=2005,])
lst3<- lapply(lst2,function(x) {
if((m
Hi,
May be this helps:
I duplicated your dataset (only one was attached) and changed the dates.
lstf1<- list.files(pattern=".txt")
lstf1
#[1] "dt3031093-1.txt" "dt3031093-2.txt" "dt3031093-3.txt"
#3rd one has less number of observations.
fun1<- function(lstf){
lst1<-lapply(lstf,function(x
You cannot have a POSIXlt column in a data frame: if you did your
homework you would know it is because it is length-9 list.
I don't know why str() is reporting POSIXt as a class, and your example
is not reproducible. Normally date-times have class
> class(Sys.time())
[1] "POSIXct" "POSIXt"
Well, i believe writing correct date format would have served the purpose.
Suppose tfr contains Date as column and is a factor by class.
tft$Date <- as.Date(as.character(tfr$Date),"%d/%m%Y") should give you the
desired output.
--
View this message in context:
http://r.789695.n4.nabble.com/D
HI,
I guess this will be more appropriate:
tfr<-read.table(text="
14/12/2000 15/12/2000 18/12/2000 19/12/2000 20/12/2000 21/12/2000
22/12/2000 25/12/2000 26/12/2000 27/12/2000 28/12/2000 29/12/2000
01/01/2001 02/01/2001 03/01/2001 04/01/2001 05/01/2001 08/01/2001
09/01/2001 10/01/2
Hi,
Try this:
tfr<-read.table(text="
14/12/2000 15/12/2000 18/12/2000 19/12/2000 20/12/2000 21/12/2000
22/12/2000 25/12/2000 26/12/2000 27/12/2000 28/12/2000 29/12/2000
01/01/2001 02/01/2001 03/01/2001 04/01/2001 05/01/2001 08/01/2001
09/01/2001 10/01/2001 11/01/2001 12/01/2001 1
Hello,
Works with me:
x <- scan(what = "character", text = "14/12/2000 15/12/2000 18/12/2000
19/12/2000 20/12/2000 21/12/2000
22/12/2000 25/12/2000 26/12/2000 27/12/2000 28/12/2000 29/12/2000
01/01/2001 02/01/2001 03/01/2001 04/01/2001 05/01/2001 08/01/2001
09/01/2001 10/01/2001 11
Oops,
Sorry, wrong number.
x <- 20101020
as.Date(as.character(x), format="%Y%m%d")
as.POSIXct(as.character(x), format="%Y%m%d")
Rui Barradas
--
View this message in context:
http://r.789695.n4.nabble.com/Dates-in-R-tp4614266p4614756.html
Sent from the R help mailing list archive at Nabble.co
Hello,
Try
x <- 20102010
as.Date(as.character(x), format="%Y%d%m")
[1] "2010-10-20"
as.POSIXct(as.character(x), format="%Y%d%m")
[1] "2010-10-20 BST"
Note that you must pass x as a character vector.
If not, the date functions will see it as the number of days since an origin
such as 1970-01-01
On 07.05.2012 10:24, BrittD wrote:
Hi everyone,
I have a file in which the dates are subscribed as for instance: 20101020.
This is 20th Octobre 2010.
strptime("20101020", format="%Y%m%d")
seems to work for me...
UWe Ligges
My problem is that R won't except this as a date, since there is
Tack on a day of the week (6 as the last day) for a point of reference
for the conversion:
> dates <- paste('6.', 0:53, '.2011', sep = '')
> dates
[1] "6.0.2011" "6.1.2011" "6.2.2011" "6.3.2011" "6.4.2011"
"6.5.2011" "6.6.2011"
[8] "6.7.2011" "6.8.2011" "6.9.2011" "6.10.2011" "6.11.2011"
I think it is called "time zones". Is "IST" India standard time, if
so that accounts for the half hour. What is your time zone and what
is the time zone of the data coming from Excel? Exactly how are you
importing it?
On Tue, Jan 18, 2011 at 5:35 AM, Shubha Vishwanath Karanth
wrote:
> Hi R,
>
On Tue, 10 Nov 2009, Sam Albers wrote:
Hello,
I am having a little trouble formatting my dates correctly. When I plot
something using the following commands, R plots the most recent date on the
left of the figure and then earlier date on the right of the figure. Given
that English is read from
> -Original Message-
> From: r-help-boun...@r-project.org
> [mailto:r-help-boun...@r-project.org] On Behalf Of Sam Albers
> Sent: Tuesday, November 10, 2009 3:08 PM
> To: r-help@r-project.org
> Subject: [R] Dates plotting backwards
>
> Hello,
>
> I am having a little trouble formatting m
>
>
> >
> > Thanks in advance!
> >
> > Sam
> >
> > Date=as.Date(test$Date, format= "%d/%m/%Y")
>
> Change that to
> test$Data <- as.Date(...)
> or plot Date instead of test$Date.
>
Yes that worked. Silly mistake. Sometimes those are the hardest ones to
spot. Thanks!
>
> Bill Dunlap
> Spotfire,
Sam Albers wrote:
Hello,
I am having a little trouble formatting my dates correctly. When I plot
something using the following commands, R plots the most recent date on the
left of the figure and then earlier date on the right of the figure. Given
that English is read from left to right I would
See last line to every message on r-help which in particular
asks for reproducible code and in this case means include
date and count. Note ?dput
This work for me:
library(lattice)
tt <- as.POSIXct(Sys.Date() + 1:10)
y <- seq_along(tt)
xyplot(y ~ tt)
as does this:
library(zoo)
xyplot(zoo(cbind
There is a one line nextfri function defined in the zoo-quickref
vignette and replacing 5 with 1 in its definition will give you next
Monday. The prior Monday is 7 days before that so take the
closest of the two. See R News 4/1 for more about dates.
On Wed, May 13, 2009 at 4:23 PM, myshare wro
On Wed, May 13, 2009 at 4:23 PM, myshare wrote:
> hi,
>
> I have a and data frame with date-column and some other columns.
> My first question is what is the fastest way to get the index of an
> array if I know the value f.e
>
> > x = c(4,5,6,7,8)
>
> so i know the value is 6.. i.e. the index is
Dear Rob,
> -Original Message-
> From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org]
On
> Behalf Of Rob Bakker
> Sent: May-03-09 7:46 AM
> To: r-help@r-project.org
> Subject: [R] dates from Stata's .dta to R's .Rdata: become character
>
> Dear Sir/Madam,
> I converted
RExcel (the addin package for RExcel I wrote)
tries very hard to transfer dates and times
from Excel to R.
David Scott wrote:
>
> I have used xlsReadWrite to read data from an Excel spreadsheet.
>
> I had a problem with converting times of the day so that I could create
> POSIXct date-time obj
> Excel stores times of the day as fractions of a day so I wrote a function to
> convert the fraction to a number of seconds, extract the hours, minutes and
> seconds and output it in ISO standard format (%H:%M:%S).
What about the 'colClasses' or 'dateTimeAs' argument in 'read.xls'
which gives bac
The chron package stores times as a fraction of the day. See R News 4/1.
On Sun, Feb 22, 2009 at 8:26 PM, David Scott wrote:
>
> I have used xlsReadWrite to read data from an Excel spreadsheet.
>
> I had a problem with converting times of the day so that I could create
> POSIXct date-time objects
The problem is in the intersect function that does x = as.vector(x) and
therefore transforms date vector into a numeric .
Try to:
d1 = as.character(data1) ; d2 = as.character(data2)
d = intersect(d1, d2)
data = as.Date(d)
A.
Tom La Bone wrote:
I have two collections of dates and I want to fig
you want:
ans <- intersect(data1,data2)
class(ans) <- c("POSIXt","POSIXct")
I personally think intersect should preserve the class of the object
(if both args have the same class), but I think r-core has a different
opinion.
-Whit
On Fri, Jan 23, 2009 at 9:02 AM, Tom La Bone wrote:
>
> I have
On Jan 31, 2008 4:25 PM, Denis Chabot <[EMAIL PROTECTED]> wrote:
> Hi all,
>
> The crashes I reported earlier were cause by R 2.6.1 for Mac not
> liking the OS date setting "french canada", an issue that has been
> solved (by Simon Urbanek). The crashes did not occur when the OS was
> set to use no
Hi all,
The crashes I reported earlier were cause by R 2.6.1 for Mac not
liking the OS date setting "french canada", an issue that has been
solved (by Simon Urbanek). The crashes did not occur when the OS was
set to use normal french formats for dates. With that setting, the
suggestions by
(I've put the R Mac list in cc because of the crashes I have
experienced trying some of the suggestions below)
Hi Gabor and Prof Ripley,
Le 31 janv. 08 à 02:11, Prof Brian Ripley a écrit :
> The output from sessionInfo() the posting guide asked for would have
> been very helpful here.
You a
The output from sessionInfo() the posting guide asked for would have been
very helpful here.
I think the problem is likely to be that these are not standard French
abbreviations according to my systems. On Linux I get
format(Sys.Date(), "%d-%b-%y")
[1] "31-jan-08"
format(Sys.Date()-50, "%d-
Suppose we have:
dd <- c("7-déc-07", "11-déc-07", "14-déc-07", "18-déc-07", "21-déc-07",
"24-déc-07", "26-déc-07", "28-déc-07", "31-déc-07", "2-janv-08",
"4-janv-08", "7-janv-08", "9-janv-08", "11-janv-08", "14-janv-08",
"16-janv-08", "18-janv-08")
Try this (where we are assuming the just release
Irina, you must have them in character format. You need to convert to Date type.
mydates = as.Date(mydates, "%m/%d/%Y")
HTH.
Horace
-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Irina Burmenko
Sent: Wednesday, November 28, 2007 11:44 AM
To: Horace Tso
Convert to Date and then compare;
> x <- as.Date("4/8/2006", "%m/%d/%Y")
> y <- as.Date("5/10/2007", "%m/%d/%Y")
> x>y
[1] FALSE
>
On Nov 28, 2007 2:44 PM, Irina Burmenko <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I have dates in the following format: 4/8/2006 (MM/DD/). I need to have
> R compar
http://finzi.psych.upenn.edu/R/library/base/html/format.Date.html
might help as a start.
--- marciarr <[EMAIL PROTECTED]> wrote:
>
> Dear R users,
> I am just starting with R and am currently needing
> a lot of help! Sorry if
> I disturb you and thank you for your answers!!!
> Here goes my qu
See:
?DateTimeClasses
?as.Date
On 07/11/2007, marciarr <[EMAIL PROTECTED]> wrote:
>
>
> Dear R users,
> I am just starting with R and am currently needing a lot of help! Sorry
> if
> I disturb you and thank you for your answers!!!
> Here goes my question: How do I make R reconize my date column
55 matches
Mail list logo