Difference between revisions of "Test variable B"
From Testiwiki
(→Formula) |
m |
||
(5 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
{{variable|moderator=Erkki Kuusisto|stub=Yes}} | {{variable|moderator=Erkki Kuusisto|stub=Yes}} | ||
+ | [[Category:Code under inspection]] | ||
== Question == | == Question == | ||
+ | A simple test variable that fetches the '''data''' defined in "Test variable A", as well as a '''function''' defined in Test variable C? | ||
== Answer == | == Answer == | ||
Line 45: | Line 17: | ||
=== Formula === | === Formula === | ||
− | <rcode | + | # The code below is used for practising; under development. |
+ | |||
+ | |||
+ | <rcode showcode="1" | ||
name="answer" | name="answer" | ||
− | label="Run | + | label="Run" |
include=" | include=" | ||
page:Object-oriented_programming_in_Opasnet|name:answer| | page:Object-oriented_programming_in_Opasnet|name:answer| | ||
page:OpasnetBaseUtils|name:generic| | page:OpasnetBaseUtils|name:generic| | ||
− | page: | + | page:Test_variable_C|name:ERF_road_Lden_HA |
" | " | ||
> | > | ||
+ | library(OpasnetBaseUtils) | ||
+ | library(xtable) | ||
− | cat("Initiation successful | + | cat("Initiation successful. \n") |
− | + | out <- op_baseGetData("opasnet_base", "Op_en5682") # Fetches data from Test variable A. | |
− | out <- op_baseGetData("opasnet_base", "Op_en5682") # | ||
− | |||
out <- tidy(out , direction = "wide") | out <- tidy(out , direction = "wide") | ||
− | print(out) | + | |
+ | # print(out) | ||
+ | print(xtable(out), type = 'html', html.table.attributes = "class='sortable'") | ||
+ | |||
+ | #mode(out) | ||
+ | #length(out) | ||
+ | #unclass(out) | ||
+ | |||
+ | road_lower_bound <- out[out$Source == "Road" & out$Indicator == "Lden", "Lower bound (dB)"] | ||
+ | road_upper_bound <- out[out$Source == "Road" & out$Indicator == "Lden", "Upper bound (dB)"] | ||
+ | road_exposed <- out[out$Source == "Road" & out$Indicator == "Lden", "Result"] | ||
+ | |||
+ | print(road_exposed) | ||
+ | print(road_lower_bound) | ||
+ | print(road_upper_bound) | ||
+ | |||
+ | # d[d$Row %in% 2:4, ] | ||
+ | # colnames(out)[colnames(out) == "obs.1"] | ||
+ | |||
+ | Lden <- 60 | ||
+ | HA <- ERF_road_Lden_HA(Lden) | ||
+ | |||
+ | Lden | ||
+ | HA | ||
+ | |||
</rcode> | </rcode> |
Latest revision as of 11:08, 26 August 2013
This page is a variable.
The page identifier is Op_en5683 |
---|
Moderator:Erkki Kuusisto (see all) |
This page is a stub. You may improve it into a full page, and then a rating bar will appear here. |
Upload data
|
Contents
Question
A simple test variable that fetches the data defined in "Test variable A", as well as a function defined in Test variable C?
Answer
Rationale
Dependencies
Formula
- The code below is used for practising; under development.
library(OpasnetBaseUtils) library(xtable) cat("Initiation successful. \n") out <- op_baseGetData("opasnet_base", "Op_en5682") # Fetches data from Test variable A. out <- tidy(out , direction = "wide") # print(out) print(xtable(out), type = 'html', html.table.attributes = "class='sortable'") #mode(out) #length(out) #unclass(out) road_lower_bound <- out[out$Source == "Road" & out$Indicator == "Lden", "Lower bound (dB)"] road_upper_bound <- out[out$Source == "Road" & out$Indicator == "Lden", "Upper bound (dB)"] road_exposed <- out[out$Source == "Road" & out$Indicator == "Lden", "Result"] print(road_exposed) print(road_lower_bound) print(road_upper_bound) # d[d$Row %in% 2:4, ] # colnames(out)[colnames(out) == "obs.1"] Lden <- 60 HA <- ERF_road_Lden_HA(Lden) Lden HA |
See also
Keywords
References
Related files
<mfanonymousfilelist></mfanonymousfilelist>