[R] chron and R 2.8

Gabor Grothendieck ggrothendieck at gmail.com
Mon Dec 1 23:50:10 CET 2008


I've had an offline conversion with Stephen about this and it seems
that in R 2.8.0 order is much slower when applied to chron objects
than previously.

The fix for zoo users is to enter this line (which is already in the development
version of zoo) before using any chron objects from zoo in your session:

ORDER.chron <- ORDER.dates <- ORDER.times <- function(x, ...)
order(as.numeric(x), ...)


On Mon, Dec 1, 2008 at 1:12 PM, stephen sefick <ssefick at gmail.com> wrote:
> These are the two functions that I use to read the data in.  I have
> reverted back to R 2.7.2, chron 2.3-24, zoo 1.5-4, StreamMetabolism
> 0.03.  This configuration works just fine- like I expect and with
> considerable time speed up over both R 2.8 and chron 2.3-24 and
> 2.3-25.
>
> fmt.chron <- function (x)
> {
>    chron(sub(" .*", "", x), gsub(".* (.*)", "\\1:00", x))
> }
>
> read.production <- function (data)
> {
>    read.zoo(data, sep = ",", FUN = fmt.chron, header = TRUE)
> }
>
>
>        DateTime RM215Temp
> 800  1/9/06 7:46     11.12
> 801  1/9/06 8:01     11.11
> 802  1/9/06 8:16     10.98
> 803  1/9/06 8:31     10.90
> 804  1/9/06 8:46     10.94
> 805  1/9/06 9:01     10.98
> 806  1/9/06 9:16     10.98
> 807  1/9/06 9:31     11.00
> 808  1/9/06 9:46     11.02
> 809 1/9/06 10:01     11.04
> 810 1/9/06 10:16     11.06
> 811 1/9/06 10:31     11.07
> 812 1/9/06 10:46     11.09
> 813 1/9/06 11:01     11.11
> 814 1/9/06 11:16     11.13
> 815 1/9/06 11:31     11.16
> 816 1/9/06 11:46     11.18
> 817 1/9/06 12:01     11.20
> 818 1/9/06 12:16     11.23
> 819 1/9/06 12:31     11.27
> 820 1/9/06 12:46     11.30
> 821 1/9/06 13:01     11.33
> 822 1/9/06 13:16     11.36
> 823 1/9/06 13:31     11.39
> 824 1/9/06 13:46     11.42
> 825 1/9/06 14:01     11.44
> 826 1/9/06 14:16     11.45
> 827 1/9/06 14:31     11.48
> 828 1/9/06 14:46     11.50
> 829 1/9/06 15:01     11.52
> 830 1/9/06 15:16     11.54
> 831 1/9/06 15:31     11.56
> 832 1/9/06 15:46     11.59
> 833 1/9/06 16:01     11.61
> 834 1/9/06 16:16     11.64
> 835 1/9/06 16:31     11.64
> 836 1/9/06 16:46     11.64
> 837 1/9/06 17:01     11.62
> 838 1/9/06 17:16     11.60
> 839 1/9/06 17:31     11.58
> 840 1/9/06 17:46     11.57
> 841 1/9/06 18:01     11.60
> 842 1/9/06 18:16     11.57
> 843 1/9/06 18:31     11.45
> 844 1/9/06 18:46     11.40
> 845 1/9/06 19:01     11.44
> 846 1/9/06 19:16     11.38
> 847 1/9/06 19:31     11.39
> 848 1/9/06 19:46     11.43
> 849 1/9/06 20:01     11.40
> 850 1/9/06 20:16     11.44
> 851 1/9/06 20:31     11.24
> 852 1/9/06 20:46     11.08
> 853 1/9/06 21:01     11.10
> 854 1/9/06 21:16     11.08
> 855 1/9/06 21:31     11.08
> 856 1/9/06 21:46     11.08
> 857 1/9/06 22:01     11.07
> 858 1/9/06 22:16     11.07
> 859 1/9/06 22:31     11.08
> 860 1/9/06 22:46     11.08
> 861 1/9/06 23:01     11.07
> 862 1/9/06 23:16     11.07
> 863 1/9/06 23:31     11.06
> 864 1/9/06 23:46     11.06
> 865 1/10/06 0:01     11.05
> 866 1/10/06 0:16     11.05
> 867 1/10/06 0:31     11.05
> 868 1/10/06 0:46     11.04
> 869 1/10/06 1:01     11.04
> 870 1/10/06 1:16     11.03
> 871 1/10/06 1:31     11.03
> 872 1/10/06 1:46     11.02
> 873 1/10/06 2:01     11.02
> 874 1/10/06 2:16     11.01
> 875 1/10/06 2:31     11.01
> 876 1/10/06 2:46     11.01
> 877 1/10/06 3:01     11.00
> 878 1/10/06 3:16     10.99
> 879 1/10/06 3:31     10.99
> 880 1/10/06 3:46     10.99
> 881 1/10/06 4:01     10.98
> 882 1/10/06 4:16     10.97
> 883 1/10/06 4:31     10.97
> 884 1/10/06 4:46     10.96
> 885 1/10/06 5:01     10.95
> 886 1/10/06 5:16     10.95
> 887 1/10/06 5:31     10.94
> 888 1/10/06 5:46     10.93
> 889 1/10/06 6:01     10.93
> 890 1/10/06 6:16     10.93
> 891 1/10/06 6:31     10.94
> 892 1/10/06 6:46     10.93
> 893 1/10/06 7:01     10.90
> 894 1/10/06 7:16     10.90
> 895 1/10/06 7:31     10.91
> 896 1/10/06 7:46     10.92
>
>
> On Mon, Dec 1, 2008 at 12:08 PM, Gabor Grothendieck
> <ggrothendieck at gmail.com> wrote:
>> The key thing to do is to provide some reproducible code that
>> someone else can use to verify the problem even if you have
>> to use it on 2.7.2 with the old chron and 2.8.0 with the new chron.
>>
>>
>> On Mon, Dec 1, 2008 at 11:34 AM, stephen sefick <ssefick at gmail.com> wrote:
>>> I have built chron 2.3-24 under 2.8 and it is acting the same as
>>> 2.3-24 and as to the previous email the zoo version is the same for
>>> both.  My next test will be to get 2.7.2 up and running again, and see
>>> what the behavior is under this version with the different versions of
>>> chron.  I have not figured out how to install || versions of R in mac
>>> OS X it looks like the packages are maintained but the application is
>>> automatically removed and updated into the current version.  What else
>>> should I try?
>>>
>>> On Mon, Dec 1, 2008 at 10:41 AM, Gabor Grothendieck
>>> <ggrothendieck at gmail.com> wrote:
>>>> Two things to try:
>>>>
>>>> - try running both under 2.7.2 instead of trying both under 2.8
>>>> - if you know how to build packages from source then try rebuilding the
>>>> chron you have under 2.7.2 using 2.98.  You can find it here:
>>>> http://cran.r-project.org/src/contrib/Archive/chron/
>>>>
>>>>
>>>> On Mon, Dec 1, 2008 at 10:35 AM, stephen sefick <ssefick at gmail.com> wrote:
>>>>> I found the library where all of the older packages are located.
>>>>>
>>>>> library(chron, lib =
>>>>> "/Library/Frameworks/R.Framework/Versions/2.7/Resources/library")
>>>>>
>>>>> Error in dyn.load(file, DLLpath = DLLpath, ...) :
>>>>>  unable to load shared library
>>>>> '/Library/Frameworks/R.Framework/Versions/2.7/Resources/library/chron/libs/i386/chron.so':
>>>>>  dlopen(/Library/Frameworks/R.Framework/Versions/2.7/Resources/library/chron/libs/i386/chron.so,
>>>>> 6): Library not loaded:
>>>>> /Library/Frameworks/R.framework/Versions/2.7/Resources/lib/libR.dylib
>>>>>  Referenced from:
>>>>> /Library/Frameworks/R.Framework/Versions/2.7/Resources/library/chron/libs/i386/chron.so
>>>>>  Reason: image not found
>>>>> Error: package/namespace load failed for 'chron'
>>>>>
>>>>> The code above works with zoo
>>>>> library(zoo, lib =
>>>>> "/Library/Frameworks/R.Framework/Versions/2.7/Resources/library")
>>>>>
>>>>>
>>>>> On Sun, Nov 30, 2008 at 10:04 PM, Gabor Grothendieck
>>>>> <ggrothendieck at gmail.com> wrote:
>>>>>> To run the old version of chron that you have under 2.7.2
>>>>>> into 2.8.0, on 2.7.2 issue the command (note initial dot):
>>>>>>
>>>>>> .libPaths()
>>>>>>
>>>>>> Suppose you find that the library that contains chron in
>>>>>> 2.7.2 is "/a/b".
>>>>>>
>>>>>> Then on 2.8.0 ensure that you don't have chron on the search path
>>>>>>
>>>>>> search()
>>>>>>
>>>>>> and if you do detach it:
>>>>>>
>>>>>> detach("package:chron")
>>>>>> search() # should no longer be there
>>>>>>
>>>>>> Then run this where "..." is the library that the old version of chron
>>>>>> is in under 2.7.2.
>>>>>>
>>>>>> library(chron, lib = "...")
>>>>>>
>>>>>> To run the new version of chron detach the old version and just use:
>>>>>>
>>>>>> library(chron)
>>>>>>
>>>>>>
>>>>>> On Sun, Nov 30, 2008 at 9:14 PM, stephen sefick <ssefick at gmail.com> wrote:
>>>>>>> Yes
>>>>>>> chron 2.3-25
>>>>>>> zoo 1.5-4
>>>>>>> R 2.8
>>>>>>> Mac OS X 10.5.5
>>>>>>>
>>>>>>> Gabor I don't know how to start up another verison of R on the mac.  I
>>>>>>> will figure this out, and get back to you (I can then test both of
>>>>>>> them side by side).
>>>>>>>
>>>>>>> other fast installation (version numbers from description files in R
>>>>>>> 2.7.2 directory)
>>>>>>> chron 2.3-24
>>>>>>> zoo 1.5-4
>>>>>>> Mac OS X 10.5.5
>>>>>>>
>>>>>>> thanks
>>>>>>>
>>>>>>> Stephen
>>>>>>>
>>>>>>> On Sat, Nov 29, 2008 at 10:19 AM, Gabor Grothendieck
>>>>>>> <ggrothendieck at gmail.com> wrote:
>>>>>>>> Are you using the same version of chron both times?
>>>>>>>>
>>>>>>>> On Sat, Nov 29, 2008 at 10:05 AM, stephen sefick <ssefick at gmail.com> wrote:
>>>>>>>>> has anyone had problems with the upgrade to R 2.8 and chron date
>>>>>>>>> classes.  I have a large zoo object that has a chron index, and it is
>>>>>>>>> taking 5x or so longer to do the same calculation as with 2.7 if it
>>>>>>>>> doesn't fail.  I will provide anything necessary I am not entirely
>>>>>>>>> sure what ya'll would need if anything to try and reproduce the
>>>>>>>>> behavior.  I am using the package StreamMetabolism.
>>>>>>>>> thanks
>>>>>>>>>
>>>>>>>>> --
>>>>>>>>> Stephen Sefick
>>>>>>>>>
>>>>>>>>> Let's not spend our time and resources thinking about things that are
>>>>>>>>> so little or so large that all they really do for us is puff us up and
>>>>>>>>> make us feel like gods.  We are mammals, and have not exhausted the
>>>>>>>>> annoying little problems of being mammals.
>>>>>>>>>
>>>>>>>>>                                                                -K. Mullis
>>>>>>>>>
>>>>>>>>> ______________________________________________
>>>>>>>>> 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.
>>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> --
>>>>>>> Stephen Sefick
>>>>>>>
>>>>>>> Let's not spend our time and resources thinking about things that are
>>>>>>> so little or so large that all they really do for us is puff us up and
>>>>>>> make us feel like gods.  We are mammals, and have not exhausted the
>>>>>>> annoying little problems of being mammals.
>>>>>>>
>>>>>>>                                                                -K. Mullis
>>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> Stephen Sefick
>>>>>
>>>>> Let's not spend our time and resources thinking about things that are
>>>>> so little or so large that all they really do for us is puff us up and
>>>>> make us feel like gods.  We are mammals, and have not exhausted the
>>>>> annoying little problems of being mammals.
>>>>>
>>>>>                                                                -K. Mullis
>>>>>
>>>>
>>>
>>>
>>>
>>> --
>>> Stephen Sefick
>>>
>>> Let's not spend our time and resources thinking about things that are
>>> so little or so large that all they really do for us is puff us up and
>>> make us feel like gods.  We are mammals, and have not exhausted the
>>> annoying little problems of being mammals.
>>>
>>>                                                                -K. Mullis
>>>
>>
>
>
>
> --
> Stephen Sefick
>
> Let's not spend our time and resources thinking about things that are
> so little or so large that all they really do for us is puff us up and
> make us feel like gods.  We are mammals, and have not exhausted the
> annoying little problems of being mammals.
>
>                                                                -K. Mullis
>



More information about the R-help mailing list