Difference between revisions of "Test variable B"

From Testiwiki
Jump to: navigation, search
m
(Formula: some further steps)
Line 25: Line 25:
 
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:Test_variable_C|name:ERF_Lden_HA
+
page:Test_variable_C|name:ERF_road_Lden_HA
 
"
 
"
 
>
 
>
 +
 +
library(OpasnetBaseUtils)
 +
library(xtable)
  
 
cat("Initiation successful. \n")
 
cat("Initiation successful. \n")
  
 
out <- op_baseGetData("opasnet_base", "Op_en5682") # Fetches data from Test variable A.
 
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'")
  
colnames(out)[colnames(out) == "obs.1"] <- "Row" # Changes the column name "obs.1" to "Row"
+
#mode(out)
out <- tidy(out , direction = "wide")
+
#length(out)
print(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
 
Lden <- 60
HA <- ERF_Lden_HA(Lden)
+
HA <- ERF_road_Lden_HA(Lden)
  
 
Lden
 
Lden

Revision as of 14:16, 21 May 2012


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

  1. The code below will not work since the table in Test variable A is in the wrong format.


- Hide code


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>

Test variable B. Opasnet . [1]. Accessed 12 May 2024.