Fixed install issue while retaining S4
authorPaul Hoffman <phoffman@nygenome.org>
Thu, 2 Nov 2017 21:06:50 +0000 (17:06 -0400)
committerPaul Hoffman <phoffman@nygenome.org>
Thu, 2 Nov 2017 21:06:50 +0000 (17:06 -0400)
DESCRIPTION
NAMESPACE
R/S4.R [deleted file]
R/package.R [new file with mode: 0644]
man/loomR.Rd [new file with mode: 0644]

index 1a74e9aadc8dce3c2dc1a026fda13e4dec4a2876..1dbe91aea5320676c5d8dbcc49ce8386d8f19508 100644 (file)
@@ -18,8 +18,8 @@ Imports:
   iterators,
   itertools
 Collate:
-  'S4.R'
   'loom.R'
+  'package.R'
 License: GPL-3
 Encoding: UTF-8
 LazyData: true
index a027ff57281cce9b6c20bda27889ae2037c6884d..1351a67ac104c4351aea0826afb4045fd8e16636 100644 (file)
--- a/NAMESPACE
+++ b/NAMESPACE
@@ -5,7 +5,6 @@ export(create)
 export(loom)
 export(map)
 export(validateLoom)
-import(R6)
 import(hdf5r)
 importFrom(R6,R6Class)
 importFrom(iterators,nextElem)
diff --git a/R/S4.R b/R/S4.R
deleted file mode 100644 (file)
index 6584e17..0000000
--- a/R/S4.R
+++ /dev/null
@@ -1,30 +0,0 @@
-#' @import R6
-#' @importFrom methods setOldClass
-NULL
-
-.onLoad <- function(libname, pkgname) {
-  setOldClass(Classes = 'loom')
-}
-
-.onAttach <- function(libname, pkgname) {
-  .onLoad(libname = libname, pkgname = pkgname)
-}
-
-# # Examples setting S4 methods for R6 classes
-# # Requires the setOldClass from above
-# setGeneric(
-#   name = 'foo',
-#   signature = 'x',
-#   def = function(x) {
-#     return(standardGeneric(f = 'foo'))
-#   }
-# )
-#
-# setMethod(
-#   f = 'foo',
-#   signature = c('x' = 'loom'),
-#   definition = function(x) {
-#     print("Hello loom!")
-#     print(' -From foo')
-#   }
-# )
diff --git a/R/package.R b/R/package.R
new file mode 100644 (file)
index 0000000..2faa0c8
--- /dev/null
@@ -0,0 +1,36 @@
+#' @importFrom methods setOldClass
+NULL
+
+#' An R interface for loom files
+#'
+#' @docType package
+#' @name loomR
+#'
+NULL
+
+# Hooks to set loom as an S4 class upon
+# loadNamespace or library/require
+.onLoad <- function(libname, pkgname) {
+  setOldClass(Classes = 'loom')
+}
+
+# # Examples setting S4 methods for R6 classes
+# # Requires the setOldClass from above
+# #' @export foo
+# methods::setGeneric(
+#   name = 'foo',
+#   signature = 'x',
+#   def = function(x) {
+#     return(standardGeneric(f = 'foo'))
+#   }
+# )
+#
+# #' @exportMethod foo
+# methods::setMethod(
+#   f = 'foo',
+#   signature = c('x' = 'loom'),
+#   definition = function(x) {
+#     print("Hello loom!")
+#     print(' -From foo')
+#   }
+# )
diff --git a/man/loomR.Rd b/man/loomR.Rd
new file mode 100644 (file)
index 0000000..dc6f85d
--- /dev/null
@@ -0,0 +1,10 @@
+% Generated by roxygen2: do not edit by hand
+% Please edit documentation in R/package.R
+\docType{package}
+\name{loomR}
+\alias{loomR}
+\alias{loomR-package}
+\title{An R interface for loom files}
+\description{
+An R interface for loom files
+}