[datatable-help] Error in a package that imports data.table

Victor Kryukov victor.kryukov at gmail.com
Thu Mar 7 04:47:18 CET 2013


Hello everyone, and thanks for your replys.

It looks like the problem was in my use of lubridate with datatable.
Removing lubridate from imports fixes it.

Every time I import *both* of these packages in R session, I get the
following:

> library(lubridate)
> library(data.table)
data.table 1.8.8  For help type: help("data.table")

Attaching package: ‘data.table’

The following object(s) are masked from ‘package:lubridate’:

    hour, mday, month, quarter, wday, week, yday, year

I haven't really paid attention to it, but now that I started
investigating, I noticed that data.table also defines all this function as
helpers to work with IDateTime. So there should be a name conflict
somewhere.

I'm puzzled about why data table would include this function/classes (isn't
it better to leave data handling to specialized classes?), but I understand
that there may be a good reason for that. Unfortunately, my code is using
lubridate heavily (it's just too good...), which leaves me in a tough spot
- I would like to use both. If I had to choose, I would be forced to
replace all lubridate code with standard R, which is not fun, but I guess I
have to bite the bullet.

Regards,
Victor

Yours Sincerely,
Victor Kryukov

US cell: +1-650-733-6510


On Mon, Mar 4, 2013 at 1:39 PM, Steve Lianoglou <
mailinglist.honeypot at gmail.com> wrote:

> I'm not sure if order matters in the NAMESPACE, but maybe you could
> try to write it manually and put the import statements up top?
>
> I haven't come across this problem, and I've got several packages that
> use data.table via importing it as you show here ...
>
> On Mon, Mar 4, 2013 at 2:35 AM, Matthew Dowle <mdowle at mdowle.plus.com>
> wrote:
> >
> > Hi,
> >
> > I don't see what's wrong then.
> >
> > Can you whittle the package down to the essential code such that you can
> > attach it and we can reproduce?
> >
> > Thanks,
> > Matthew
> >
> >
> >
> > On 04.03.2013 06:32, Victor Kryukov wrote:
> >>
> >> Hi Matthew,
> >>
> >> my DESCRIPTION file has the following section:
> >>
> >> Imports:
> >>     data.table,
> >>     lubridate
> >>
> >> and my (generated) NAMESPACE contains
> >>
> >> export(ProcessTransactionSurvey)
> >> import(data.table)
> >> import(lubridate)
> >>
> >> My R CMD CHECK (run with check() from devtools) mostly runs OK but
> >> fails at the end with the following error, which is expected since I
> >> haven't created any documentation yet. I'm not sure yet have to fix
> >> this LaTeX warning (I do have latex installed on my machine).
> >>
> >> * checking PDF version of manual ... WARNING
> >> LaTeX errors when creating PDF version.
> >> This typically indicates Rd problems.
> >> LaTeX errors found:
> >> * checking PDF version of manual without hyperrefs or index ... ERROR
> >> Error: Command failed (1)
> >>
> >> Anything else I should check?
> >>
> >> Victor
> >>
> >>
> >> On Mar 3, 2013, at 3:26 PM, Matthew Dowle <mdowle at mdowle.plus.com>
> wrote:
> >>
> >>>
> >>> Hi,
> >>>
> >>> Did you include data.table in either the Imports or Depends field of
> your
> >>> package's DESCRIPTION file?
> >>>
> >>> I've just improved data.table FAQ 6.9 to make that clearer.
> >>>
> >>> If it still doesn't work, does your package fully pass "R CMD check"?
> >>>
> >>> Matthew
> >>>
> >>>
> >>> On 03.03.2013 22:25, Victor Kryukov wrote:
> >>>>
> >>>> Hello,
> >>>>
> >>>> I'm developing an R package which will be used internally at my
> >>>> company, and I have troubles using data.table. I'm very new to package
> >>>> development and I'm not really sure whether the errors I see are
> >>>> related to data.table or not, but here it is anyway.
> >>>>
> >>>> I have a function that imports data from .csv files and cleans the
> >>>> data (subsets, converting fields to numeric etc.). As the end of the
> >>>> function definition, I convert the resulting data.frame to data.table
> >>>> and return the result:
> >>>>
> >>>> ProcessData <- function(…) {
> >>>>         ...
> >>>>         df <- data.table(df)
> >>>>         df
> >>>> }
> >>>>
> >>>> When I use this function standalone, after
> >>>>
> >>>> library(data.package)
> >>>>
> >>>> everything works as expected. However, when I'm defining this
> >>>> function as a part of a package and later call it, I'm getting the
> >>>> following error:
> >>>>
> >>>> Error in rbind(deparse.level, ...) :
> >>>>  could not find function ".rbind.data.table"
> >>>>
> >>>> Please note that in the package .R files, I'm not importing
> >>>> data.table directly with library(data.package) but rather have
> >>>> `import(data.table)` statement in my NAMESPACE, as recommended here
> >>>> https://github.com/hadley/devtools/wiki/Namespaces.
> >>>>
> >>>> When I import data.table directly with library(data.table) after
> >>>> importing my package, everything works as expected.
> >>>>
> >>>> I suspect there may be something going wrong with namespaces in
> >>>> data.table.
> >>>>
> >>>> My environment: I'm using R 2.15.3 on Mac and have tested the above
> >>>> on both data.table 1.8.6 and 1.8.7. Please let me know if I need to
> >>>> provide more info. Any help will be much appreciated!
> >>>>
> >>>> Regards,
> >>>> Victor
> >>>>
> >>>> _______________________________________________
> >>>> datatable-help mailing list
> >>>> datatable-help at lists.r-forge.r-project.org
> >>>>
> >>>>
> >>>>
> https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/datatable-help
> >>>
> >>>
> >>
> >> _______________________________________________
> >> datatable-help mailing list
> >> datatable-help at lists.r-forge.r-project.org
> >>
> >>
> >>
> https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/datatable-help
> >
> > _______________________________________________
> > datatable-help mailing list
> > datatable-help at lists.r-forge.r-project.org
> >
> https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/datatable-help
>
>
>
> --
> Steve Lianoglou
> Graduate Student: Computational Systems Biology
>  | Memorial Sloan-Kettering Cancer Center
>  | Weill Medical College of Cornell University
> Contact Info: http://cbio.mskcc.org/~lianos/contact
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/datatable-help/attachments/20130306/4d2d317b/attachment-0001.html>


More information about the datatable-help mailing list