Re: [R] Strage result with an append/strptime combination

2007-08-30 Thread Ptit_Bleu

Hi again,

Just a quick post to propose another solution (without chron) :
strptime function on the whole object and not on each namefile. 

 namefile-070707050642.dat
 namefile-append(namefile,namefile)
 namefile-append(namefile,namefile)
 namefile
[1] 070707050642.dat 070707050642.dat 070707050642.dat
070707050642.dat
 jourheure-strptime(namefile,%d%m%y%H%M%S)
 jourheure
[1] 2007-07-07 05:06:42 2007-07-07 05:06:42 2007-07-07 05:06:42
2007-07-07 05:06:42




Gabor Grothendieck wrote:
 
 Try chron:
 
 library(chron)
 namefile - 070707050642.dat#day-month-year-hour-minute-second.dat
 x - chron(substr(namefile, 1, 6), substr(namefile, 7, 12),
 +   format = c(dmy, hms), out.format = c(m/d/y, h:m:s))
 c(x, x)
 [1] (07/07/07 05:06:42) (07/07/07 05:06:42)
 
 See R News 4/1 Help Desk article for more.
 
 


 Hi,

 I keep on trying to write some small scripts in order to learn R but even
 with basic scripts I have problems ...

 I start with the name of a file which is in fact the time the file has
 been
 generated (I cannot change the format). Then I convert namefile with
 strptime. The problem occurs when I add another time from another file
 with
 append. It displays some informations I don't want.

 I found a post about this problem
 (http://www.nabble.com/Error-with-strptime-tf3607942.html#a10081942) but
 I
 don't understand the solution. I tested as.POSIXct or as.POSIX.lt but it
 has
 no effect.

 Do you have some ideas to solve this problem ?
 Thank you for your help.
 Ptit Bleu.

 ---

 namefile-070707050642.dat#day-month-year-hour-minute-second.dat
 jourheure-strptime(namefile,%d%m%y%H%M%S)

  jourheure
 [1] 2007-07-07 05:06:42

 jourheure-append(jourheure,jourheure)
  jourheure
 [1] 2007-07-07 05:06:42 Paris, Madrid (heure d'été) 2007-07-07
 05:06:42
 Paris, Madrid (heure d'été)

 --
 View this message in context:
 http://www.nabble.com/Strage-result-with-an-append-strptime-combination-tf4347401.html#a12385852
 Sent from the R help mailing list archive at Nabble.com.

 __
 R-help@stat.math.ethz.ch 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@stat.math.ethz.ch 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://www.nabble.com/Strange-result-with-an-append-strptime-combination-tf4347401.html#a12403499
Sent from the R help mailing list archive at Nabble.com.

__
R-help@stat.math.ethz.ch 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] Strage result with an append/strptime combination

2007-08-29 Thread Ptit_Bleu

Hi,

I keep on trying to write some small scripts in order to learn R but even
with basic scripts I have problems ...

I start with the name of a file which is in fact the time the file has been
generated (I cannot change the format). Then I convert namefile with
strptime. The problem occurs when I add another time from another file with
append. It displays some informations I don't want.

I found a post about this problem
(http://www.nabble.com/Error-with-strptime-tf3607942.html#a10081942) but I
don't understand the solution. I tested as.POSIXct or as.POSIX.lt but it has
no effect.

Do you have some ideas to solve this problem ?
Thank you for your help.
Ptit Bleu.

---

namefile-070707050642.dat#day-month-year-hour-minute-second.dat
jourheure-strptime(namefile,%d%m%y%H%M%S)

 jourheure
[1] 2007-07-07 05:06:42

jourheure-append(jourheure,jourheure)
 jourheure
[1] 2007-07-07 05:06:42 Paris, Madrid (heure d'été) 2007-07-07 05:06:42
Paris, Madrid (heure d'été)

-- 
View this message in context: 
http://www.nabble.com/Strage-result-with-an-append-strptime-combination-tf4347401.html#a12385852
Sent from the R help mailing list archive at Nabble.com.

__
R-help@stat.math.ethz.ch 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] Strage result with an append/strptime combination

2007-08-29 Thread Gabor Grothendieck
Try chron:

 library(chron)
 namefile - 070707050642.dat#day-month-year-hour-minute-second.dat
 x - chron(substr(namefile, 1, 6), substr(namefile, 7, 12),
+   format = c(dmy, hms), out.format = c(m/d/y, h:m:s))
 c(x, x)
[1] (07/07/07 05:06:42) (07/07/07 05:06:42)

See R News 4/1 Help Desk article for more.


On 8/29/07, Ptit_Bleu [EMAIL PROTECTED] wrote:

 Hi,

 I keep on trying to write some small scripts in order to learn R but even
 with basic scripts I have problems ...

 I start with the name of a file which is in fact the time the file has been
 generated (I cannot change the format). Then I convert namefile with
 strptime. The problem occurs when I add another time from another file with
 append. It displays some informations I don't want.

 I found a post about this problem
 (http://www.nabble.com/Error-with-strptime-tf3607942.html#a10081942) but I
 don't understand the solution. I tested as.POSIXct or as.POSIX.lt but it has
 no effect.

 Do you have some ideas to solve this problem ?
 Thank you for your help.
 Ptit Bleu.

 ---

 namefile-070707050642.dat#day-month-year-hour-minute-second.dat
 jourheure-strptime(namefile,%d%m%y%H%M%S)

  jourheure
 [1] 2007-07-07 05:06:42

 jourheure-append(jourheure,jourheure)
  jourheure
 [1] 2007-07-07 05:06:42 Paris, Madrid (heure d'été) 2007-07-07 05:06:42
 Paris, Madrid (heure d'été)

 --
 View this message in context: 
 http://www.nabble.com/Strage-result-with-an-append-strptime-combination-tf4347401.html#a12385852
 Sent from the R help mailing list archive at Nabble.com.

 __
 R-help@stat.math.ethz.ch 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@stat.math.ethz.ch 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] Strage result with an append/strptime combination

2007-08-29 Thread Ptit_Bleu

Thanks Gabor !

It works.
Just one more thing : is there a possibility to remove ( and ) before I
copy the data to a MySQL database.

Again thank you for the tip.
Ptit Bleu.


Gabor Grothendieck wrote:
 
 Try chron:
 
 library(chron)
 namefile - 070707050642.dat#day-month-year-hour-minute-second.dat
 x - chron(substr(namefile, 1, 6), substr(namefile, 7, 12),
 +   format = c(dmy, hms), out.format = c(m/d/y, h:m:s))
 c(x, x)
 [1] (07/07/07 05:06:42) (07/07/07 05:06:42)
 
 See R News 4/1 Help Desk article for more.
 
 
 On 8/29/07, Ptit_Bleu [EMAIL PROTECTED] wrote:

 Hi,

 I keep on trying to write some small scripts in order to learn R but even
 with basic scripts I have problems ...

 I start with the name of a file which is in fact the time the file has
 been
 generated (I cannot change the format). Then I convert namefile with
 strptime. The problem occurs when I add another time from another file
 with
 append. It displays some informations I don't want.

 I found a post about this problem
 (http://www.nabble.com/Error-with-strptime-tf3607942.html#a10081942) but
 I
 don't understand the solution. I tested as.POSIXct or as.POSIX.lt but it
 has
 no effect.

 Do you have some ideas to solve this problem ?
 Thank you for your help.
 Ptit Bleu.

 ---

 namefile-070707050642.dat#day-month-year-hour-minute-second.dat
 jourheure-strptime(namefile,%d%m%y%H%M%S)

  jourheure
 [1] 2007-07-07 05:06:42

 jourheure-append(jourheure,jourheure)
  jourheure
 [1] 2007-07-07 05:06:42 Paris, Madrid (heure d'été) 2007-07-07
 05:06:42
 Paris, Madrid (heure d'été)

 --
 View this message in context:
 http://www.nabble.com/Strage-result-with-an-append-strptime-combination-tf4347401.html#a12385852
 Sent from the R help mailing list archive at Nabble.com.

 __
 R-help@stat.math.ethz.ch 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@stat.math.ethz.ch 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://www.nabble.com/Strage-result-with-an-append-strptime-combination-tf4347401.html#a12386702
Sent from the R help mailing list archive at Nabble.com.

__
R-help@stat.math.ethz.ch 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] Strage result with an append/strptime combination

2007-08-29 Thread Ptit_Bleu

In french, I wouls say Chapeau bas. In english, no idea. So I just say
Thanks again.
Ptit Bleu (reading chron reference manual :-).



Try


fmt - function(x) with(month.day.year(x),
sprintf(%02d/%02d/%02d %02d:%02d:%02d, month, day, year,
hours(x), minutes(x), seconds(x)))
fmt(x)


On 8/29/07, Ptit_Bleu [EMAIL PROTECTED] wrote:

 Thanks Gabor !

 It works.
 Just one more thing : is there a possibility to remove ( and ) before
 I
 copy the data to a MySQL database.

 Again thank you for the tip.
 Ptit Bleu.
-- 
View this message in context: 
http://www.nabble.com/Strange-result-with-an-append-strptime-combination-tf4347401.html#a12387275
Sent from the R help mailing list archive at Nabble.com.

__
R-help@stat.math.ethz.ch 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] Strage result with an append/strptime combination

2007-08-29 Thread Gabor Grothendieck
Try


fmt - function(x) with(month.day.year(x),
sprintf(%02d/%02d/%02d %02d:%02d:%02d, month, day, year,
hours(x), minutes(x), seconds(x)))
fmt(x)


On 8/29/07, Ptit_Bleu [EMAIL PROTECTED] wrote:

 Thanks Gabor !

 It works.
 Just one more thing : is there a possibility to remove ( and ) before I
 copy the data to a MySQL database.

 Again thank you for the tip.
 Ptit Bleu.


 Gabor Grothendieck wrote:
 
  Try chron:
 
  library(chron)
  namefile - 070707050642.dat#day-month-year-hour-minute-second.dat
  x - chron(substr(namefile, 1, 6), substr(namefile, 7, 12),
  +   format = c(dmy, hms), out.format = c(m/d/y, h:m:s))
  c(x, x)
  [1] (07/07/07 05:06:42) (07/07/07 05:06:42)
 
  See R News 4/1 Help Desk article for more.
 
 
  On 8/29/07, Ptit_Bleu [EMAIL PROTECTED] wrote:
 
  Hi,
 
  I keep on trying to write some small scripts in order to learn R but even
  with basic scripts I have problems ...
 
  I start with the name of a file which is in fact the time the file has
  been
  generated (I cannot change the format). Then I convert namefile with
  strptime. The problem occurs when I add another time from another file
  with
  append. It displays some informations I don't want.
 
  I found a post about this problem
  (http://www.nabble.com/Error-with-strptime-tf3607942.html#a10081942) but
  I
  don't understand the solution. I tested as.POSIXct or as.POSIX.lt but it
  has
  no effect.
 
  Do you have some ideas to solve this problem ?
  Thank you for your help.
  Ptit Bleu.
 
  ---
 
  namefile-070707050642.dat#day-month-year-hour-minute-second.dat
  jourheure-strptime(namefile,%d%m%y%H%M%S)
 
   jourheure
  [1] 2007-07-07 05:06:42
 
  jourheure-append(jourheure,jourheure)
   jourheure
  [1] 2007-07-07 05:06:42 Paris, Madrid (heure d'été) 2007-07-07
  05:06:42
  Paris, Madrid (heure d'été)
 
  --
  View this message in context:
  http://www.nabble.com/Strage-result-with-an-append-strptime-combination-tf4347401.html#a12385852
  Sent from the R help mailing list archive at Nabble.com.
 
  __
  R-help@stat.math.ethz.ch 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@stat.math.ethz.ch 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://www.nabble.com/Strage-result-with-an-append-strptime-combination-tf4347401.html#a12386702
 Sent from the R help mailing list archive at Nabble.com.

 __
 R-help@stat.math.ethz.ch 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@stat.math.ethz.ch 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.