Dear All,
We are pleased to announce that useR! 2024 will be a hybrid conference, taking
place 8-11 July in Salzburg, Austria.
The conference website is yet to be set up. In the meantime, you can keep
up-to-date the following ways:
useR! LinkedIn Page: https://www.linkedin.com/company/user-con
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
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 Earth Engine. I am investigating
whether the co
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[
Hello all, I did not attach data as this is probably simple answer that I
cannot find.
I am collecting daily data and would like to plot the data by week but now
that we are into the new year, my plots started over with 01 after the last
week of the year. How can I continuously keep adding weeks
"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
Hi
Can anyone explain why a date becomes numeric when you loop over a series
of dates?
> dt <- Sys.Date()
> dt
[1] "2017-11-14"
> class(dt)
[1] "Date"
> dts <- dt - 1:0
> class(dts)
[1] "Date"
>
> for (i in dts) {
+ print(i)
+ print(class(i))
+ print(as.Date(i, "1970-01-01"))
+ pr
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
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 lesson and I am analyzing data in R
programming. I have to project in this lesson and I am working on wind
energ
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
All
I am having trouble converting dates into a uniform type using the R-code,I am
not sure what is wrong with my syntax.But could you please tell me a more
efficient way to qorking with time-series dates .I have attached the excel file
that I want to convert dates on
Regards
__
2015" "Jul 2015" "Aug
2015"
[8] "Sep 2015" "Oct 2015" "Nov 2015" "Dec 2015" "Jan 2016" "Feb 2016" "Mar
2016"
[15] "Apr 2016" "May 2016" "Jun 2016"
-
Hi All,
I am trying to convert the vector below to dates please assist I have tried to
use information on the links you sent, but it is not working.
X = c(201501, 201502, 201503, 201505, 201506, 201507, 201508, 201509, 201510,
201511, 201512, 201601, 201602, 201603, 201604, 201605, 201606)
li
2016"
[15] "Apr 2016" "May 2016" "Jun 2016"
-
David L Carlson
Department of Anthropology
Texas A&M University
College Station, TX 77840-4352
-Original Message-
From: R-help [mailto:r-help-boun...@r-project.org]
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
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
Mean :18946659 Mean :19027233
3rd Qu.:19220911 3rd Qu.:19
>
Dear Contributors
I have a problem concerning the replication of a variable with
the date structure.
I have the following database of 12000 observations
bank.list.m:
name date
aba.1ABA 2006-10-24
aba.2ABA 2006-11-30
aba.3ABA 2006-10-24
aba.4
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"
When I try to do linear interpolation between financial contracts with
maturities on different dates in different months I have come across some
behavior I haven't seen before.
I have a data frame in R which is loaded from an access database so I can't
provide a working example. It was loaded
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
uot;
head(tfr2)
dates
1 2000-12-14
2 2000-12-22
3 2001-01-01
4 2001-01-09
5 2001-01-17
6 2001-01-25
A.K.
- Original Message -
From: Trying To learn again
To: r-help@r-project.org
Cc:
Sent: Saturday, August 4, 2012 12:09 PM
Subject: [R] DAtes
Hi all,
I´m trying to convert as
; "2001-02-02" "2001-02-12" "2001-02-20"
A.K.
- Original Message -
From: Trying To learn again
To: r-help@r-project.org
Cc:
Sent: Saturday, August 4, 2012 12:09 PM
Subject: [R] DAtes
Hi all,
I´m trying to convert as a data frame (with format "da
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
Hi all,
I´m trying to convert as a data frame (with format "date") this copied
excel column of dates (exposed below), I have tried to save them in a txt
file
tfr<-read.table("tfra.txt")
tfr<-data.frame(tfr)
I have tried several things, as date, so on, but always error.
And it makes
Error en as.
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
Hi everyone,
I have a file in which the dates are subscribed as for instance: 20101020.
This is 20th Octobre 2010.
My problem is that R won't except this as a date, since there is no sign to
seperate the Year, Month and Day
and that it will only see it as an origin, which it is not.
Does anyone k
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"
Hi,
I would be very grateful for some advice. I have read the help pages for
Date, strptime, etc. All examples seem to use some version of day month year
as date format. However I have Weekly composite data so ONLY want to input
the dates as Week.Year (eg 35.2011). strptime seems to show this is p
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,
>
Hi R,
The dates when exported from Excel to R by "Put R Var", gives one less
day.
For example,
1.Let 1/1/2011 be the cell A1 in date format.
2.Right click and select "Put R Var" and give a name to it say,
"StartDate" (R in foreground process)
3.In the R console see the value
Its best to use dput when displaying your data in r-help as in dput(z)
or dput(head(z)) if large.
Try this:
> library(zoo)
> # test data
> z <- zoo(1:2, factor(c("04/16/09","04/17/09")))
>
> # 1
> aggregate(z, function(x) as.Date(x, "%m/%d/%y"))
2009-04-16 2009-04-17
1 2
>
> # o
or
> or # 3
> aggregate(z, as.Date(time(z), "%m/%d/%y"))
2009-04-16 2009-04-17
1 2
On Thu, Jun 10, 2010 at 9:58 AM, Gabor Grothendieck
wrote:
> Its best to use dput when displaying your data in r-help as in dput(z)
> or dput(head(z)) if large.
>
> Try this:
>
>> library(zoo)
>
Dear R People:
I have a zoo object with its date index as a factor.
> xAle1.zoo$index
Error in xAle1.zoo$index : $ operator is invalid for atomic vectors
> str(xAle1.zoo)
Class 'zoo' atomic [1:32] 1253 1316 1038 1157 1710 1489 1159 1142 945 1245 ...
..- attr(*, "index")= Factor w/ 32 levels "0
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 havi
>
>
> >
> > 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
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 like to have the dat
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
Hi,
I'm trying to do something simple (I think) with lattice graphics. I want
to have three xyplots in a single column, where the x axis for the three is
a date range and the y axes are numeric.
I tried doing the first chart, and ran into a problem. When I enter:
xyplot (date ~ count)
I get a
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
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 3. What I currently do is
loop over the array, I was thinking if
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 charac
Dear Sir/Madam,
I converted the .dta into .Rdata with the foreign library read.dta. However,
when I use fix() I get the message that the dates are discarded.
Before fix(), class(dateX) gives 'dates' as class; after fix() class(dateX)
gives 'character'
Why is that?
Best regards,
Rob Bakker
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
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. I was wondering if there was a better
solution.
Excel stores times of the day as fractions of a day so I wrote a function
to co
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
I have two collections of dates and I want to figure out what dates they have
in common. This is not giving me what I want (I don't know what it is giving
me). What is the best way to do this?
Tom
> data1
[1] "1948-02-24 EST" "1949-04-12 EST" "1950-05-29 EDT" "1951-05-21 EDT"
[5] "1951-12-20 E
Hello all,
I wish to plot several hundred data groups in a boxplot(), with
sensible labels on the x axis. For small datasets, this is possible by
using the "names" parameter to the boxplot. However, for several
hundred boxplots, boxplot() displays a tick on the x axis for every one.
For m
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
Hello R users,
I have to import a file with one column containing dates written in
French short format, such as:
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
To: Horace Tso; r-help@r-project.org
Subject: [R] Dates in R
Hi,
I have dates in the following format: 4/8/2006 (MM/DD/). I need to have R
compare date A to date B to figure out which one is more recent. Is there a
way to do that? Simply using the '>' or '<' sign
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
Hi,
I have dates in the following format: 4/8/2006 (MM/DD/). I need to have R
compare date A to date B to figure out which one is more recent. Is there a
way to do that? Simply using the '>' or '<' signs doesn't seem to work. I
think in this case R treats '/' as a division sign and give
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
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 columns as dates?
When I "summary" my table, the levels of my date column are completely out
of order.
82 matches
Mail list logo