Displaying 20 results from an estimated 7000 matches similar to: "Can strptime handle milliseconds or AM/PM?"
2007 Jun 12
1
Can strptime handle milliseconds or AM/PM?
I'm trying to proess date/time fields from files that were given to me to
analyze.
Any clues what I'm doing wrong with strptime? This seems to fail the same
way under Linux or Windows.
For ?strptime would it make sense to explain %OS3 somewhere besides the
Examples?
> # Why does %OS3 work here?
> format(Sys.time(), "%H:%M:%S")
[1] "16:45:19"
>
2013 Feb 08
4
convert 12 time stamp to 24 hour
Readers,
For a 12 hour time stamp:
> testtime<-("2013-01-01 01:00:01 PM")
> testtime
[1] "2013-01-01 01:00:01 PM"
> testtime24hour<-strftime(testtime,'%H:%M:%S')
> testtime24hour
[1] "01:00:01"
how to convert to 24 hour format so that the object 'testtime24hour' is:
'13:00:01'
Thanks.
--
r2151
2013 Feb 14
5
plot custom x axis ticks values
Readers,
For this data set:
testvalues<-c(10,20,30,40)
How to amend the plot instruction:
plot(testvalues,ann=FALSE,type='l',yaxt='n',xaxt='n')
so that x axis ticks labels can be added to existing graph with
arbitrary value such as 0,100,200,300)?
Thanks in advance.
--
r2151
2013 Feb 15
1
file copy to password protected network drive
I am trying to copy files to a password protected drive which is "Ranch" at
TACC from another network drive. I am logged in to the source drive and can
run R there. The following code does not even find the destination folder.
file.copy("sourcedrive/file.tar", "
username@ranch.tacc.utexas.edu/uniqueID/destinationfolder/file.tar",
overwrite = FALSE)
Thanks in
2010 May 24
2
AM/PM strptime %p failing 2.11.0 WinXP
I am attempting to import dates in the following format to R:
5/20/2010 6:45:32 PM
Unfortunately I am unable to get the AM/PM function (%p) to work correctly
under either 2.11.0 or 2.8.1.
> strptime("5/20/2010 6:45:32 PM", "%m/%d/%Y %I:%M:%S %p")
[1] NA
but
> strptime("5/20/2010 6:45:32", "%m/%d/%Y %I:%M:%S")
[1] "2010-05-20 06:45:32"
2013 Jan 29
2
remove margin between plot and axis
Readers,
Am trying to plot a graph with type 'h' and want to remove the white
space between the plot lines and the x axis. The help section 'par'
suggests that the option 'mai' controls this feature, but the syntax
plot(...mai=c(0,1,1))
is ineffective
Any advice please?
--
r2151
2013 Feb 08
1
plot ᵒ C in graph axis label
Readers,
For a part of the 'plot' command:
...ylab=expression(paste('rate (',degree~C^-1,')'))...
Is it possible to introduce 'thinspace' (e.g. '\thinspace' in LaTeX)
between the degree (?) sign and the centigrade (C) symbol?
--
r2151
2013 Jan 16
1
function approx interpolation of time series data sets
Readers,
Am trying to use the function 'approx' to interpolate time series data sets:
data1:
01:23:40 5
01:23:45 10
01:23:50 12
01:23:55 7
data2:
01:23:42
01:23:47
01:23:51
01:23:54
The objective is to obtain interpolated values of 'data1' column 2 (5,
10, 12, 7) for the times shown in data2. Tried the following command
but received the error shown:
2013 Mar 07
1
create vector from indices interpolated values
Readers,
Is it possible to create a plot command based upon the indices of
missing values in a data set?
dataset1<-read.table(text='
10 2
20 NA
30 5
40 7
50 NA
60 NA
70 2
80 6
90 NA
100 9
')
dataset2<-read.table(text='
0.2
0.4
0.1
0.9
0.2
0.3
1.1
0.7
0.9
0.6
0.4
')
The 'approx' function is used to obtain the interpolated values for
'NA' in dataset1.
2013 Jan 30
1
remove label from specific axis
Readers,
For a graph plot instruction:
plot(seq(10:50),type='h',yaxt='n',yaxs='i',lab=c(20,2,2),xlab='x axis
label',bty='l',main='graph title')
how to remove y-axis label and keep the x-axis label?
_
r2151
2016 Feb 24
1
%OS on output
R help on 'strptime' has the following in "Details" section.
Specific to R is ?%OSn?, which for output gives the seconds truncated to ?0 <= n <= 6? decimal places (and if ?%OS? is not followed by a digit, it uses the setting of ?getOption("digits.secs")?, or if that is unset, ?n = 3?).
In reality, for output, if '%OS' is not followed by a digit and
2013 Feb 14
1
approxfun values
Readers,
According to the help '?approxfun', the function can be used to obtain
the interpolated values. The following test was tried:
> testinterpolation<-read.csv('test.csv',header=FALSE)
> testinterpolation
V1 V2
1 10 2
2 20 NA
3 30 5
4 40 7
5 50 NA
6 60 NA
7 70 2
8 80 6
9 90 9
10 100 NA
>
2009 Nov 04
1
Convert H:MM:SS PM /AM into 24 HR syntax
I've got an array of times in H:MM:SS PM/AM format, e.g. "5:27:15 PM" (no leading zero), and I would like to convert them over to 24 HR syntax, e.g. HH:MM:SS.
If it matters, the times are from the Central Time zone.
Is there a command to convert the time to a 24HR format?
I tried the following:
ptime("5:27:15 PM", "%H:%M:%S")
[1] "2009-11-04
2013 Feb 18
2
mtext unicode failure
Readers,
How to solve this unicode input error please?
> postscript("~/tmp/test.eps",width=100/25.4,height=100/25.4,horizontal=FALSE,onefile=TRUE,paper="special")
> testx<-seq(1:5)
> testy<-seq(1:5)
> plot(testy~testx)
> mtext('text (O?)\n more text',side=3,line=1)
Warning messages:
1: In mtext("text (O?)\n more text", side = 3, line =
2008 May 30
3
Strptime
Hi
This code should explain what I'm trying to do
> strptime("30-Jan-08", "%d-%b-%y")
[1] "2008-01-30"
>
> format(strptime("30-Jan-08", "%d-%b-%y") , "%b-%y")
[1] "Jan-08"
>
> strptime(format(strptime("30-Jan-08", "%d-%b-%y") , "%b-%y") ,
"%b-%y")
[1] NA
I have a
2007 Jan 08
1
Does strptime(...,tz="GMT") do anything?
Hi All
In trying to correlate some tide gauge data I need to deal with varying
timezones. From the documentation on strptime, it seemed that the tz
variable might have some effect on the conversion, but I'm not seeing an
effect.
> strptime("20061201 1:02 PST",format="%Y%m%d %H:%M",tz="PST")+0
[1] "2006-12-01 01:02:00 EST"
>
2011 Jul 06
1
trouble parsing a date using strptime()
Hi,
I am having a trouble parsing dates using strptime() that I get in the
format of year and week number. The data looks like this "201127" which
means year 2011 and week 27. I would like to graph this using ggplot but
then I get a gap between 201054 and 201101 so I thought I would just easily
convert it.
I tried to use strptime and as.Date and the format string of %Y%W but it
seems
2006 Apr 15
1
strptime failure R 2.2.1 (PR#8773)
Full_Name: Bill Hutchison
Version: 2.2.1
OS: Windows XP
Submission from: (NULL) (69.158.121.13)
example(strptime) produces the following error:
Error in strptime(x, "%d%b%Y") : 2 arguments passed to 'strptime' which requires
3
This error occurs wherever strptime is used. It does not occur in 2.2.0
2011 Jun 17
1
issue with strptime
Hi everyone,
I have bunch of date and time observations in the format %Y-%m-%d %I %M %S
%p. I used strptime() to read this format. But the problem is some of the
times are in the format of %I %M %p, so for those times, strptime is giving
me NA values.
For example,
strptime(paste("2009-04-08","1:49:47 PM"),format="%Y-%m-%d %I:%M:%S %p")
[1] "2009-04-08
2017 Jan 11
4
bug with strptime, %OS, and "."
Hi R Devel,
I just ran into a corner case with 'strptime'. Recall that the "%OS"
conversion accepts fractional seconds:
> strptime("17_35_14.01234.mp3","%H_%M_%OS.mp3")$sec
[1] 14.01234
Unfortunately for my application it seems to be "greedy", in that it
tries to parse a decimal point which might belong to the rest of the
format:
>