File: setNMFClass.R

package info (click to toggle)
r-cran-nmf 0.23.0-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid
  • size: 3,344 kB
  • sloc: cpp: 680; ansic: 7; makefile: 2
file content (52 lines) | stat: -rw-r--r-- 1,579 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# Factory method for NMF model classes
# 
# Author: Renaud Gaujoux
# Creation: 18 Jul 2012
###############################################################################

#' @include NMF-class.R
NULL

if( FALSE ){ #START_DEACTIVATE
	
## #' Factory Method for NMF Model Classes
## #' 
## #' Defines two S4 classes for representing NMF models: one to hold data from 
## #' the actual model, the other one to hold fitting data for model estimated with 
## #' the function \code{\link{nmf}}. 
## #' 
#setNMFClass <- function(Class, ..., where=topns(), contains='NMFstd', VERBOSE=TRUE){
#	
#	# add 'NMF' to contains if necessary
#	wNMF <- sapply(contains, isNMFclass)
#	if( !length(wNMF) || !any(wNMF) ){
#		contains <- c(contains, 'NMFstd')
#		parentNMFClass <- 'NMFstd'
#	}else{
#		parentNMFClass <- contains[which(wNMF)]
#	}
#	
#	# extract NMF prefix if present
#	Class <- sub('^NMF(.*)', "\\1", Class)
#	# define class names
#	NMFClass <- str_c('NMF', Class)
#	NMFfitClass <- str_c(NMFClass, '_fit')
#	if( VERBOSE ){
#		message("Defining NMF classes: ", NMFClass , "(", parentNMFClass , ") and "
#				, NMFfitClass, ' in ', str_ns(where), ' ... '
#				, appendLF=FALSE)
#	}
#	# 1. Create model class
#	setClass(NMFClass, ..., where=where, contains=contains)
#	
#	# 2. Create model fit class (in the same environment as the model class)
#	e <- packageEnv(getClassDef(NMFClass)@package)
#	setClass(NMFfitClass, where=e, contains=c('NMFfit', NMFClass))
#	
#	if( VERBOSE ) message('OK')
#	
#	# return the name of the two new classes
#	c(NMFClass, NMFfitClass)
#}  

}#END_DEACTIVATE