Re: [R] median for time data

2009-12-03 Thread uvilla

Hi again.
I´m sorry to ask again but I cannot do the boxplot coprrectly.

I'm typing:

start.posix=as.POSIXct(skiers[,3])
boxplot(start.posix)


where skiers[,3] is my time data,
and I get this error

I have no idea of what that means.. All the other steps are ready, like the
median of the time data, but Im really stock trying to do the boxplot with
the time data on the y axis to interprete the median 

Thanks again




Jannis v. Buttlar wrote:
 
 
 
 uvilla schrieb:
 When I use strptime() I just get NA NA NA
 I`m new at using R, must finisth this work thoug
 
 I guess Im doing totally wrong, actually everytime i try to use POSIXct
 it
 doesn`t work
 
 
 If you have a look at help(strptime) you find that you have to specify 
 the format in which you time is written.
 
 Try
 
 strptime(08:10:10,%H:%M:%S)
 
 The stuff after the comma in the  is the way to give strptime the
 format.
 
 Now you only have use
 
 strptime(vectorwithyourtime,%H:%M:%S)
 
 and you should get a vector with R format times out of it. It uses 
 todays date though but for your calculations this should work. This 
 POSIXct format is not very handy to use though, so you perhaps better 
 consider using library(chron) as Gabor suggested.
 
 
 
 
 Thanks a lot
 
 
 
 Jannis wrote:
 Hi,


 try to convert this to the R time format POSIXct or POSIXlt via 
 strptime(). Then you can simply substract them. I am not sure whether a 
 median can be calculated though (should be possible as POSIXct stores 
 the value as seconds since 1970)

 Best
 Jannis

 uvilla schrieb:
 Hi everybody

 How do I do to calculate the median and average of a colum of time data
 like
 this: 8:50:10. I also need to plot the time difference between two
 colums
 Thanks a lot
 __
 R-help@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.



 
 __
 R-help@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/median-for-time-data-tp932287p947591.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@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.


Re: [R] median for time data

2009-12-03 Thread Jannis
I fear nobody can really help you as we can not really understandd what 
your problem is. What does the error message read? What values does 
start.posix have? And what skiers?


You should include the code for a reproducable example. include at least 
2 values for skiers[,3] in their correct format and class, so we can run 
the code ourselves and check what is going on.


Then we can (hopefully) help you.

uvilla schrieb:

Hi again.
I´m sorry to ask again but I cannot do the boxplot coprrectly.

I'm typing:

start.posix=as.POSIXct(skiers[,3])
boxplot(start.posix)


where skiers[,3] is my time data,
and I get this error

I have no idea of what that means.. All the other steps are ready, like the
median of the time data, but Im really stock trying to do the boxplot with
the time data on the y axis to interprete the median 


Thanks again




Jannis v. Buttlar wrote:



uvilla schrieb:

When I use strptime() I just get NA NA NA
I`m new at using R, must finisth this work thoug

I guess Im doing totally wrong, actually everytime i try to use POSIXct
it
doesn`t work

If you have a look at help(strptime) you find that you have to specify 
the format in which you time is written.


Try

strptime(08:10:10,%H:%M:%S)

The stuff after the comma in the  is the way to give strptime the
format.

Now you only have use

strptime(vectorwithyourtime,%H:%M:%S)

and you should get a vector with R format times out of it. It uses 
todays date though but for your calculations this should work. This 
POSIXct format is not very handy to use though, so you perhaps better 
consider using library(chron) as Gabor suggested.






Thanks a lot



Jannis wrote:

Hi,


try to convert this to the R time format POSIXct or POSIXlt via 
strptime(). Then you can simply substract them. I am not sure whether a 
median can be calculated though (should be possible as POSIXct stores 
the value as seconds since 1970)


Best
Jannis

uvilla schrieb:

Hi everybody

How do I do to calculate the median and average of a colum of time data
like
this: 8:50:10. I also need to plot the time difference between two
colums
Thanks a lot

__
R-help@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.



__
R-help@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.



:-((:-((


__
R-help@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.


[R] median for time data

2009-12-01 Thread uvilla

Hi everybody

How do I do to calculate the median and average of a colum of time data like
this: 8:50:10. I also need to plot the time difference between two colums
Thanks a lot
-- 
View this message in context: 
http://n4.nabble.com/median-for-time-data-tp932287p932287.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@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.


Re: [R] median for time data

2009-12-01 Thread Jannis

Hi,


try to convert this to the R time format POSIXct or POSIXlt via 
strptime(). Then you can simply substract them. I am not sure whether a 
median can be calculated though (should be possible as POSIXct stores 
the value as seconds since 1970)


Best
Jannis

uvilla schrieb:

Hi everybody

How do I do to calculate the median and average of a colum of time data like
this: 8:50:10. I also need to plot the time difference between two colums
Thanks a lot


__
R-help@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.


Re: [R] median for time data

2009-12-01 Thread uvilla

Thanks a lot for your answer Jannis.
Actually, I should have specified what I`m trying to do.
I have a datafame which 3 colums, one is the person ID, second is Anfag
and third is Ende. The two time colums are in this way: 8:50:10, so I
have to calculate the medan of the Anfag colum and to determine the length
of the route.
When I use strptime() I just get NA NA NA
I`m new at using R, must finisth this work thoug

I guess Im doing totally wrong, actually everytime i try to use POSIXct it
doesn`t work

Thanks a lot



Jannis wrote:
 
 Hi,
 
 
 try to convert this to the R time format POSIXct or POSIXlt via 
 strptime(). Then you can simply substract them. I am not sure whether a 
 median can be calculated though (should be possible as POSIXct stores 
 the value as seconds since 1970)
 
 Best
 Jannis
 
 uvilla schrieb:
 Hi everybody
 
 How do I do to calculate the median and average of a colum of time data
 like
 this: 8:50:10. I also need to plot the time difference between two
 colums
 Thanks a lot
 
 __
 R-help@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/median-for-time-data-tp932287p932402.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@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.


Re: [R] median for time data

2009-12-01 Thread Gabor Grothendieck
# input

library(chron)
tt - times(c(8:50:10, 9:40:20, 10:55:45))
tt2 - times(c(01:00:00, 02:00:00, 03:00:00))
tt
tt2

# calc median and differences (although it will give results as fractions of
a day if there are negative results)

median(tt)
tt - tt2
tt2 - tt

On Tue, Dec 1, 2009 at 10:46 AM, uvilla maruchave...@hotmail.com wrote:


 Hi everybody

 How do I do to calculate the median and average of a colum of time data
 like
 this: 8:50:10. I also need to plot the time difference between two colums
 Thanks a lot
 --
 View this message in context:
 http://n4.nabble.com/median-for-time-data-tp932287p932287.html
 Sent from the R help mailing list archive at Nabble.com.

 __
 R-help@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@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.


Re: [R] median for time data

2009-12-01 Thread Jannis v. Buttlar



uvilla schrieb:

When I use strptime() I just get NA NA NA
I`m new at using R, must finisth this work thoug

I guess Im doing totally wrong, actually everytime i try to use POSIXct it
doesn`t work



If you have a look at help(strptime) you find that you have to specify 
the format in which you time is written.


Try

strptime(08:10:10,%H:%M:%S)

The stuff after the comma in the  is the way to give strptime the format.

Now you only have use

strptime(vectorwithyourtime,%H:%M:%S)

and you should get a vector with R format times out of it. It uses 
todays date though but for your calculations this should work. This 
POSIXct format is not very handy to use though, so you perhaps better 
consider using library(chron) as Gabor suggested.






Thanks a lot



Jannis wrote:

Hi,


try to convert this to the R time format POSIXct or POSIXlt via 
strptime(). Then you can simply substract them. I am not sure whether a 
median can be calculated though (should be possible as POSIXct stores 
the value as seconds since 1970)


Best
Jannis

uvilla schrieb:

Hi everybody

How do I do to calculate the median and average of a colum of time data
like
this: 8:50:10. I also need to plot the time difference between two
colums
Thanks a lot

__
R-help@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.






__
R-help@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.


Re: [R] median for time data

2009-12-01 Thread uvilla

Thanks you both

Jannis now it is working!!. I just have one mor request, please!
How I'm suppose to make a boxplot with anfang, when working with times, it
just have on the y axis some decimal number which make no sense. i need the
time to appear in the y axis in order to see the median in the boxplot


Thanks again!!!



Jannis v. Buttlar wrote:
 
 
 
 uvilla schrieb:
 When I use strptime() I just get NA NA NA
 I`m new at using R, must finisth this work thoug
 
 I guess Im doing totally wrong, actually everytime i try to use POSIXct
 it
 doesn`t work
 
 
 If you have a look at help(strptime) you find that you have to specify 
 the format in which you time is written.
 
 Try
 
 strptime(08:10:10,%H:%M:%S)
 
 The stuff after the comma in the  is the way to give strptime the
 format.
 
 Now you only have use
 
 strptime(vectorwithyourtime,%H:%M:%S)
 
 and you should get a vector with R format times out of it. It uses 
 todays date though but for your calculations this should work. This 
 POSIXct format is not very handy to use though, so you perhaps better 
 consider using library(chron) as Gabor suggested.
 
 
 
 
 Thanks a lot
 
 
 
 Jannis wrote:
 Hi,


 try to convert this to the R time format POSIXct or POSIXlt via 
 strptime(). Then you can simply substract them. I am not sure whether a 
 median can be calculated though (should be possible as POSIXct stores 
 the value as seconds since 1970)

 Best
 Jannis

 uvilla schrieb:
 Hi everybody

 How do I do to calculate the median and average of a colum of time data
 like
 this: 8:50:10. I also need to plot the time difference between two
 colums
 Thanks a lot
 __
 R-help@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.



 
 __
 R-help@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/median-for-time-data-tp932287p932511.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@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.