69831

“object not found” error when creating a new geom

Question:

Full disclosure: this issue is duplicated on the ggplot2 google group

I'm developing a package that makes heavy use of ggplot2. I've created my own geom—geom_rug_alt—as a way of putting rug fringes on the top/right of the plot instead of the default locations.

My problem is that when geom_rug_alt() is defined and called within a single script, it seems to plot just fine. (Please try it yourself to verify that.) But, in my package geom_rug_alt() is defined in one file (CommonFunctions.R) and called in another (the Residuals() function of larger function foo.R). When I call foo.R on something, I get this error:

Error in geom_rug_alt(aes(x = NULL, y = within.group.residuals, color = factor(within.1.sd.of.the.mean.of.all.residuals)), : object 'GeomRugAlt' not found

Now, I've done a couple of things (suggested by Hadley in this thread) to try to make sure that geom_rug_alt() should work properly within the package:

  1. I define GeomRugAlt as a proto object in a file essentially called CommonFunctions.R within my package. CommonFunctions.R contains lines 3-42 of my example script.

  2. In CommonFunctions.R, I was sure to include the build_accessor() line for geom_rug_alt (line 42 in my example script) after the definition of GeomRugAlt

  3. In the package DESCRIPTION file, I have a collate: line where CommonFunctions.R appears first

  4. In the package DESCRIPTION file, I have a LazyLoad: false line
  5. In CommonFunctions.R, I included a require(ggplot2) call before defining GeomRugAlt as a proto object.
  6. In foo.R, I included a require(ggplot2) call before calling geom_rug_alt() within Residuals().

I'm not sure what else I'm missing. Given that my example script runs just fine, I suspect the issue isn't that my geom doesn't work, but that I'm doing something wrong as part of the package development process.

Sorry for duplicating the issue, but I can't seem to find a thorough solution to the problem :-(

Answer1:

Put export(GeomRugAlt) in the NAMESPACE file.



Recommend

  • How can I pass different types of parameters (ex: array) into a functional class?
  • How can I use a keyword as a property name?
  • Used Variables in Tree
  • JavaScript - Can we set javascript objects in cookies?
  • Pandas - find nearest dates between two DataFrames without loop
  • Use allowDiskUse in criteria query with Grails and the MongoDB plugin?
  • Custom Nav Title offset ios 11
  • Regex for nested values
  • Aptana 3 remove bundle (jquery)
  • Find group of records that match multiple values
  • Scipy Leastsq Optional Output Variable (Mesg)
  • Subclassing QGraphicsItem prevents me from being able to use itemAt() on a QGraphicsScene/View
  • Why Encoding.ASCII != ASCIIEncoding.Default in C#?
  • one Local Olampyad Questions on Informatic in 2011
  • Email verification using google app script and google forms
  • Lost migrations and Azure database is now out of sync
  • Get one-time binding to work for ng-if
  • Sails.js/waterline: Executing waterline queries in toJSON function of a model?
  • Dynamically accessing properties of knockoutjs observable array
  • Jenkins: How To Build multiple projects from a TFS repository?
  • Sony Xperia Z Tablet not found by adb
  • How to recover from a Spring Social ExpiredAuthorizationException
  • Redux, normalised entities and lodash merge
  • Do create extension work in single-user mode in postgres?
  • How can I estimate amount of memory left with calling System.gc()?
  • Why winpcap requires both .lib and .dll to run?
  • RestKit - RKRequestDelegate does not exist
  • Run Powershell script from inside other Powershell script with dynamic redirection to file
  • KeystoneJS: Relationships in Admin UI not updating
  • Load html files in TinyMce
  • How can I get HTML syntax highlighting in my editor for CakePHP?
  • How to set the response of a form post action to a iframe source?
  • Hits per day in Google Big Query
  • coudnt use logback because of log4j
  • Are Kotlin's Float, Int etc optimised to built-in types in the JVM? [duplicate]
  • unknown Exception android
  • Binding checkboxes to object values in AngularJs
  • Net Present Value in Excel for Grouped Recurring CF
  • jQuery Masonry / Isotope and fluid images: Momentary overlap on window resize
  • How to load view controller without button in storyboard?