Skip to content

convert 12 time stamp to 24 hour

5 messages · Rui Barradas, PIKAL Petr, e-letter

#
Readers,

Have since tried to plot converted 24 hour data:

testtimedataset
        V1
1 13:01:41
2 13:02:10
3 13:02:38
4 13:03:05
5 13:03259
Error in function (formula, data = NULL, subset = NULL, na.action = na.fail,  :
  invalid type (list) for variable 'testtimedataset'

Was expecting to see a graph with ordinate values 1:5 for the time
series values on the abscissa. What is the mistake please?

--
r2151
#
Hello,

You're trying to plot the df, not the column. Try

plot(testdata ~ testtimedataset$V1)


Hope this helps,

Rui Barradas

Em 11-02-2013 13:30, e-letter escreveu:
#
Hi
The main mistake is that you did not pay attention to provided documentation especially R-intro.

You try to plot a data frame against a vector testdata. We do not know, what is testtimedataset. You shall provide at least 

str(testtimedataset)
or better
dput(testtimedataset)

Anyway, by

plot(testdata~testtimedataset$V1)

you will get rid of error message but depending on testtimedataset mode you can get different one.

Regards
Petr
#
On 11/02/2013, PIKAL Petr <petr.pikal at precheza.cz> wrote:
With my real data set, revealed that after conversion, the time series
data consists of 'chr' which I guess means character type data,
reporting the following error:

Error in plot.window(...) : need finite 'xlim' values
In addition: Warning messages:
1: In xy.coords(x, y, xlabel, ylabel, log) : NAs introduced by coercion
2: In min(x) : no non-missing arguments to min; returning Inf
3: In max(x) : no non-missing arguments to max; returning -Inf


Does this mean I must convert the 24-hour time series values to
POSIX*t type objects; if so how please?
Confirmed, thanks.
#
Hi
Do not guess. There is extensive help in R which you can ivoke by"?".

?mode
?typeof
Yes.
?strptime

Regards
Petr