[R] HELP boxplot for time class

uvilla maruchavez83 at hotmail.com
Sat Dec 5 18:38:32 CET 2009


Thanks a lot Gabor, now I could finally plot the as time data. I just have
one more question, and I hope it is the last. 

In the script of the boxplot, 

bp <- boxplot(as.numeric(skiers$start), yaxt = "n")
axis(2, bp$stats, times(bp$stats), las = 2, cex.axis = 0.5)

I have been trying to add a main tittle and xlab, ylab with no succes. Where
I am supposed to type: main="skiing starting tour" and so on


Thanks a lot!!

Maria




Gabor Grothendieck wrote:
> 
> Try this:
> 
> Lines <- " protokollid     date        start      end
> 4 2/23/2009  8:50:10 15:17:30
> 4 2/24/2009  9:47:00 13:52:25
> 5 3/22/2009  8:51:25 12:00:05"
> 
> library(chron)
> skiers <- read.table(textConnection(Lines), header = TRUE, as.is = TRUE)
> skiers <- transform(skiers, date = dates(date),
>     start = times(start), end = times(end))
> 
> bp <- boxplot(as.numeric(skiers$start), yaxt = "n")
> axis(2, bp$stats, times(bp$stats), las = 2, cex.axis = 0.5)
> 
> 
> On Sat, Dec 5, 2009 at 6:52 AM, uvilla <maruchavez83 at hotmail.com> wrote:
> 
>>
>> hi again
>>
>> I will try this time to explain my problem clearly
>> I have the following data from the file skiing.csv (3 first rows)
>>
>>  protokollid     date        start      end
>> 1            4 2/23/2009  8:50:10 15:17:30
>> 2            4 2/24/2009  9:47:00 13:52:25
>> 3            5 3/22/2009  8:51:25 12:00:05
>>
>>
>> I have the following script
>>
>> library(chron)
>>
>> skiers=read.csv("skiing.csv")
>> strptime("08:50:10","%H:%M:%S")
>>
>> start=times(skiers[,3])
>> strptime(start,"%H:%M:%S")
>> end=times(skiers[,4])
>> strptime(end,"%H:%M:%S")
>>
>> #calc lenght of the route
>> length.route=end-start
>>
>> #calc medians
>> median(start)
>> median(length.route)
>>
>> Then I want to do a box plot of the staring time
>> when I use:
>>
>> boxplot(start)
>>
>> this error appears: Warning message:
>> In is.na(x) : is.na() applied to non-(list or vector) of type 'NULL'
>>
>> when I try to convert start as POSIXct
>>
>> > start=as.POSIXct(start)
>> Error in as.POSIXct.default(start) :
>>  do not know how to convert 'start' to class "POSIXlt"
>>
>> and when I try to convert skiers[,3] as POSIXct
>>
>> > skiers[,3]=as.POSIXct(skiers[,3])
>> Error in as.POSIXlt.character(as.character(x)) :
>>  character string is not in a standard unambiguous format
>>
>> start is of "times" class and skiers[,3] of "factor" class
>>
>> I want to do a boxplot of the starting time of my data, which reflect the
>> median " 08:36:45", and all O get in the y axis are decimal numbers :(
>> Help please
>>
>> Best regards
>>
>> Maria Stauss
>>
>>
>> --
>> View this message in context:
>> http://n4.nabble.com/HELP-boxplot-for-time-class-tp949154p949154.html
>> Sent from the R help mailing list archive at Nabble.com.
>>
>> ______________________________________________
>> R-help at r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide
>> http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>>
> 
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
> 
> 

-- 
View this message in context: http://n4.nabble.com/HELP-boxplot-for-time-class-tp949154p949270.html
Sent from the R help mailing list archive at Nabble.com.




More information about the R-help mailing list