Loris Bennett <loris.bennett at fu-berlin.de>
on Mon, 8 Aug 2016 14:12:47 +0200 writes:
> Loris Bennett <loris.bennett at fu-berlin.de> writes:
> Continuing the topic for my future self and others equally poorly versed
> in The Art and Dark Science of Interpreting R Error Messages, if I have
> the following in the file "my_data"
> 1094165 2016-07-24T09:40:02 13-23:03:28 1 COMPLETED
> 1112076 2016-08-01T14:45:49 6-13:26:15 1 COMPLETED
>> d <- read.table("my_data")
>> colnames(d) <- c("jobid","start","elapsed","alloccpus","state")
>> df <- transform(d,start = as.POSIXct(start,format="%Y-%m-%dT%H:%M:%S"),elapsed = as.difftime(elapsed,format="%d-%H:%M:%S"))
> Error in as.difftime(elapsed, format = "%d-%H:%M:%S") :
> 'tim' is not character or numeric
Well, let me argue that you should have found this to be a *helpful*
error message. You are no complete beginner anymore, right,
so
1) the error is in your use of as.difftime().
2) ?as.difftime or str(difftime)
both clearly indicate that 'tim' is the first argument of as.difftime,
and I really do wonder why you continued with the infamous
"trial-and-error programming technique" instead of reading or at
least quickly browsing the relevant reference, i.e., help page
Martin