Displaying 20 results from an estimated 10000 matches similar to: "What is wrong with this plotting?"
2004 May 27
2
axis.POSIXct: Datetime data and plotting
I've run into a problem with the datetime axis generated by axis.POSIXct. It appears a similar issue was discussed in October 2003 under the subject line "datetime data and plotting" (see https://stat.ethz.ch/pipermail/r-help/2003-October/039071.html), but I wasn't able to determine whether there is a straightforward solution.
The code below produces a graph with apparently
2012 Mar 30
1
lubridate:ymd_hm and coercion of class POSIXct. Smooth way to restore the date format.
Dear all,
I wish to create a POSIXct variable from date and time variables using the ymd_hm function in package lubridate. In some cases data for time is missing, which causes a problem for ymd_hm. I wish to find a smooth way to handle this.
# Some example data:
x <- data.frame(date = c("2011-09-22", "2011-07-28"), time = c("15:00", NA))
x
# paste date and
2004 May 17
1
Plotting Time against Date for time series data?
Dear all,
I have a data set containing GPS fixes of animal locations. To check that
the GPS's are working properly, I would like to plot the time of the fixes
(y-axis) against the date of the fixes (x-axis). If all works well, the
plot should show four regular fixes per day. The x-axis should be labelled
with month/year (i.e. 11/04) and the y-axis by hour from 00 to 24. I would
like to
2004 May 19
2
POSIX to ts and back to POSIX
I am trying to use POSIX datetime objects rather than chron datetime
objects but am having difficulty with POSIX in a time series. My
question: Once a POSIXct vector is bound to a time series, is there a
function to convert back to POSIXct? The following code demonstrates
what I am trying to do.
> ts(as.POSIXct(strptime(tmp,"%m/%d/%Y %H:%M:%S")),freq=1440)
Time Series:
Start =
2010 Oct 11
2
(no subject)
Dear List,
I am trying to plot date vs. time, but am having problems getting my y-axis
labels how I want them.? When left on its own R plots time at 6 hour intervals
from 03:00 to 23:00.? I am wanting 6 hour intervals from 2:00 to 22:00.? I
realize yaxp doesn't work in plot(), so I am trying to get it to work in par().?
However, now I get the ticks where I want them but the time is output
2006 Aug 25
1
How to get back POSIXct format after calculating with hist() results
Hi,
I have a casting/formatting question on hist.POSIXt:
The histogram plot from POSIXct works perfect (with help of Prof. Ripley
-thanks!).
When processing the hist(plot=FALSE) output and then plotting the
results over the x-axis (bins) coming from hist(), I lose the date/time
labels, getting instead integers displayed.
Trying to cast the $breaks with as.POSIXct gives silly results with
2009 Oct 05
6
Date-Time-Stamp input method for user-specific formats
Date-Time-Stamp input method to correctly interpret user-specific
formats:coding is 90% there - based on exmple at
http://tolstoy.newcastle.edu.au/R/help/05/02/12003.html
...anyone got the last 10% please?
CONTEXT:
Data is received where one of the columns is a datetimestamp. At midnight,
the value represented as text in this column consists of just the date part,
e.g.
2005 May 11
2
time zones, daylight saving etc.
Hi, I have a whole bunch of data, which looks like:
15/03/2003 10:20 1
15/03/2003 10:21 0
15/03/2003 12:02 0
16/03/2003 06:10 0
16/03/2003 06:20 0.5
16/03/2003 06:30 0
16/03/2003 06:40 0
16/03/2003 06:50 0
18/03/2003 20:10 0.5
etc. (times given on a 24 hour clock)
and goes on for years. I have some code:
2004 Oct 19
2
Sweave and Trellis in R 2.0.0patched (Windows)
I've been using the following code to plot using Sweave in version
1.9.1
library(RODBC)
library(lattice)
channel <-odbcConnectExcel("h:/water.xls")
data <- sqlQuery(channel,"select * from `Sheet1$` where Test = 'TOC' and
(Valve='5010-05' or Valve='8030-V26' or Valve='1180-08' or
Valve='5040-08')")
odbcClose(channel)
srt <-
2012 Jul 17
3
NA instead of time stamp
I was wondering why I get <NA> instead of the timestamp in the following.
Thanks.
> dataDir <- file.path(wd)
> localRaw <- read.csv(file.path(dataDir,"LOCAL.csv"), as.is=T,stringsAsFactors
= FALSE)
> localRaw[1:2,]
Year Month Day hour minute second Temp1mab Temp7mab Temp14mab Salinity1mab
1 2009 10 5 0 0 0 11.288 13.675 13.743 33.513
2008 Feb 08
2
When I cbind the POSIXct gets lost
I would like to create a new dataframe from the DateTime column of an
existing dataframe and a numeric vector. When I do cbind(x[,1], y) the
result is:
[1,] 1199370600 12.500
[2,] 1199371200 69.375
[3,] 1199371800 23.750
where the first column you see used to look like:
"2008-01-03 08:30:00 Central Standard Time"
"2008-01-03 08:40:00 Central Standard Time"
2012 May 30
1
fractional seconds in POSIXct
Hi,
Using the following simple character vector representing a time series
with fractional seconds:
datetime <- c("20/09/2011 13:00:59.00", "20/09/2011 13:00:59.02",
"20/09/2011 13:00:59.04")
Conversion to POSIXct runs into problems; the second element is not
interpreted correctly:
---<--------------------cut
2011 May 25
2
Importing fixed-width data
I have a data set where the lines look like:
2011-05-13 00:00:00 EONAAL330 dfa13002516PSCNONA
2011-05-13 00:00:01 EONAAL223 laa13044510AS.NONM
Some lines are missing the field before and after the NON:
2011-05-13 00:00:05 EONBHS229 mia13001621NON
I read them into R using
df = read.fwf(file, widths=c(19,-4,7,3,8,2,1,3,1),
2012 Jul 14
3
Can't understand syntax
OK, I need help!!
I've been searching, but I don't understand the logic of some this
dataframe addressing syntax.
What is this type of code called?
test [["v3"]] [is.na(test[["v2"]])] <-10 #choose column v3 where column v2
is == 4 and replace with 10
and where is it documented?
The code below works for what I want to do (find the non-missing value in a
row),
2011 Jan 16
2
Time and xts
Hi all,
I have run into a problem and some help would be highly appreciated.
I have a .csv with the following columns:
Date Time Open High Low Close
1/2/2005 17:05 1.3546 1.3553 1.3546 1.35495
1/2/2005 17:10 1.3553 1.3556 1.3549 1.35525
1/2/2005 17:15 1.3556 1.35565 1.35515 1.3553
1/2/2005 17:25 1.355 1.3556 1.355 1.3555
?.
?..
2/13/2006 5:20 1.18895 1.18925 1.18835 1.1885
1)
2006 Aug 23
1
how to get a histogram of an POSIXct vector ?
Hi,
search on web indicates that R also includes a hist method on POSIXct
vectors.
My (perhaps too unexperienced) approach below yields an error.
Could somebody give me a hint what's wrong ?
Peter
> str(samples)
`data.frame': 7500 obs. of 1 variable:
$ DateTime:'POSIXct', format: chr "2006-07-20 00:10:08" "2006-07-20
00:11:17" "2006-07-20
2010 Jun 14
1
Subtracting POSIXct data/times
I have two dataframe columns of POXIXct data/times that include seconds.
I got them into this format using for example
zsort$ETA <- as.POSIXct(as.character(zsort$ETA), format="%m/%d/%Y %H:%M:%S")
My problem is that when I subtract the two columns, sometimes the
difference is given in seconds, and sometimes it is given in minutes. I
don't care which it is, but I need to know which
2010 Dec 16
2
moving average with gaps in time series
I have a time series with interval of 2.5 minutes, or 24 observations per
hour. I am trying to find a 1 hr moving average, looking backward, so
that moving average at n = mean(n-23 : n)
The time series has about 1.5 million rows, with occasional gaps due to
poor data quality. I only want to take a 1 hour moving average for those
periods that are complete, i.e. have 24 observations in the
2012 Oct 23
1
Filling a covariance matrix
useRs ?
I?m working with the attached data that contains one year?s worth of
sub-daily observations of flow (?Q?) and specific conductance (?SC?, a
surrogate for concentration) at a point in a stream. The R code posted
below shows the extent of data processing thus far. My goal is to create a
covariance matrix that takes on the following form:
Q1 Q2 ? Q365 SC1 SC2 ? SC365
Q1
Q2
?
Q365
2011 Sep 08
2
help subsetting data based on date AND time
Dear R Community,
I am new to R, and have a question that I suspect may be quite simple but is
proving a formidable roadblock for me. I have a large data set that
includes water-quality measurements collected over many 24-hour periods.
The date and time of sample collection are in a combined Date/Time field in
the format yyyy-mm-dd hh:mm:ss. I need to be able to subset the data for
analysis of