Difference between revisions of "OpasnetUtils/Ovariable"
From Testiwiki
(→setclass.ovariable: marginal changed to type 'logical', prototype (defaults) added) |
(changed the structure of the page) |
||
Line 4: | Line 4: | ||
{{method|moderator=|stub=Yes}} | {{method|moderator=|stub=Yes}} | ||
− | = | + | == Definition == |
− | == | ||
− | |||
− | == | + | === Description === |
− | + | Defines the S4 class "ovariable" which is the basic building block in open assessments | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
+ | === Code === | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
<rcode | <rcode | ||
name="setclass.ovariable" | name="setclass.ovariable" | ||
Line 71: | Line 38: | ||
</rcode> | </rcode> | ||
− | = | + | == Constructor functions == |
− | ==Description== | + | |
+ | === <u>movariable</u> === | ||
+ | |||
+ | ==== Description ==== | ||
+ | |||
+ | movariable takes a data.frame, a function, and a list and makes an ovariable out of them. It is a subfunction of [[OpasnetUtils/Ovariable#make.ovariable|make.ovariable]] and prevents infinite recursion of S4 methods. | ||
+ | |||
+ | ==== Code ==== | ||
+ | <rcode | ||
+ | name="movariable" | ||
+ | label="Initiate functions" | ||
+ | graphics="1" | ||
+ | > | ||
+ | # MOVARIABLE ########## movariable takes a data.frame, a function, and a list and makes an ovariable out of them. It is a | ||
+ | #####subfunction of make.ovariable and prevents infinite recursion of S4 methods. | ||
+ | movariable <- function( | ||
+ | data, | ||
+ | formula, | ||
+ | dependencies, | ||
+ | name | ||
+ | ) { | ||
+ | output <- interpret(data) | ||
+ | out <- new("ovariable", | ||
+ | name = name, | ||
+ | output = output, | ||
+ | data = data, | ||
+ | marginal = ifelse(colnames(output) %in% c("Result", "Unit"), FALSE, TRUE), | ||
+ | formula = formula, | ||
+ | dependencies = dependencies | ||
+ | ) | ||
+ | out <- update(out) | ||
+ | return(out) | ||
+ | } | ||
+ | |||
+ | </rcode> | ||
+ | |||
+ | === <u>make.ovariable</u> === | ||
+ | ====Description==== | ||
make.ovariable takes a vector or data.frame and makes an ovariable out of it. | make.ovariable takes a vector or data.frame and makes an ovariable out of it. | ||
− | ==Code== | + | ====Code==== |
<rcode | <rcode | ||
name="make.ovariable" | name="make.ovariable" |
Revision as of 09:53, 15 June 2012
This page is a method.
The page identifier is Op_en5731 |
---|
Moderator:Nobody (see all) Click here to sign up. |
This page is a stub. You may improve it into a full page, and then a rating bar will appear here. |
Upload data
|
Contents
Definition
Description
Defines the S4 class "ovariable" which is the basic building block in open assessments
Code
Constructor functions
movariable
Description
movariable takes a data.frame, a function, and a list and makes an ovariable out of them. It is a subfunction of make.ovariable and prevents infinite recursion of S4 methods.
Code
make.ovariable
Description
make.ovariable takes a vector or data.frame and makes an ovariable out of it.