Reputation: 531
when im trying to execute the the following command:
cat(summary.rbga(GAmodel))
the output is:
Error in cat(summary.rbga(GAmodel)):
could not find function "summary.rbga"
im sure that i import the package by the command "library(genalg)" and it works perfectly for other functions. im using Version 0.98.1102 on windows.
Upvotes: 0
Views: 2814
Reputation: 206197
The function summary.rbga
is in genalg
but it's not exported from the package explicitly. It's the special implementation of the summary
function for rbga
objects. In the example from the help page, you can see how it works
evaluate <- function(string=c()) {
returnVal = 1 / sum(string);
returnVal
}
rbga.results = rbga.bin(size=10, mutationChance=0.01, zeroToOneRatio=0.5,
evalFunc=evaluate)
class(rbga.results)
# [1] "rbga"
summary(rbga.results, echo=TRUE)
# GA Settings
# Type = binary chromosome
# Population size = 200
# Number of Generations = 100
# Elitism = 40
# Mutation Chance = 0.01
#
# Search Domain
# Var 1 = [,]
# Var 0 = [,]
#
# GA Results
# Best Solution : 1 1 1 1 1 1 1 1 1 1
Note that you call summary
rather than summary.rbga
directly. As long as you pass in an object that has class "rbga" it will work.
You can access the function directly with genalg:::summary.rbga
Upvotes: 8