Difference between revisions of "OpasnetUtils/Drafts"

From Testiwiki
Jump to: navigation, search
(Answer: oggplot updated)
(Answer)
Line 15: Line 15:
 
  objects.latest("Op_en6007", code_name = "answer")
 
  objects.latest("Op_en6007", code_name = "answer")
  
<rcode name="answer" embed=1 store=1>
+
<rcode name="answer" embed=0 store=1>
  
 
library(OpasnetUtils)
 
library(OpasnetUtils)
 +
 +
##################### Forgets decisions so that decision indices will be recreated.
 +
 +
forgetDecisions <- function() {
 +
for(i in ls(envir = openv)) {
 +
if("dec_check" %in% names(openv[[i]])) openv[[i]]$dec_check <- FALSE
 +
}
 +
return(cat("Decisions were forgotten.\n"))
 +
}
  
 
#################### Perus-ggplot ovariableille
 
#################### Perus-ggplot ovariableille
Line 57: Line 66:
 
################## Sähkön hinta tunneittain
 
################## Sähkön hinta tunneittain
  
price <- opbase.data(ident="op_en7353")
+
#price <- opbase.data(ident="op_en7353")
temperature <- opbase.data("op_en6315.2014_5_2015")
+
#temperature <- opbase.data("op_en6315.2014_5_2015")
temperature$Date <- substr(temperature$Date, 0, 11)
+
#temperature$Date <- substr(temperature$Date, 0, 11)
price$Date <- substr(price$Date, 0, 11)
+
#price$Date <- substr(price$Date, 0, 11)
mon <- c("Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec")
+
#mon <- c("Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec")
for (i in mon) {
+
#for (i in mon) {
price$Date <- gsub(i, which(mon == i), as.character(price$Date))
+
# price$Date <- gsub(i, which(mon == i), as.character(price$Date))
}
+
#}
for (i in mon) {
+
#for (i in mon) {
temperature$Date <- gsub(i, which(mon == i), as.character(temperature$Date))
+
# temperature$Date <- gsub(i, which(mon == i), as.character(temperature$Date))
}
+
#}
price$Hours <- substr(price$Hours, 0, 2)
+
#price$Hours <- substr(price$Hours, 0, 2)
price$Hours <- paste(price$Hours, ":00:00", sep="")
+
#price$Hours <- paste(price$Hours, ":00:00", sep="")
temperature$Time <- paste(temperature$Time, ":00", sep="")
+
#temperature$Time <- paste(temperature$Time, ":00", sep="")
as.character(temperature$Result)
+
#as.character(temperature$Result)
as.numeric(temperature$Result)
+
#as.numeric(temperature$Result)
cut(temperature$Result, breaks = c(-21, -18, -15, -12, -9, -6, -3, 0, 3, 6, 9, 12, 15, 18, 21, 24, 27, 30), include.lowest=TRUE)
+
#cut(temperature$Result, breaks = c(-21, -18, -15, -12, -9, -6, -3, 0, 3, 6, 9, 12, 15, 18, 21, 24, 27, 30), #include.lowest=TRUE)
DateTime <- as.POSIXct(paste(temperature$Date, temperature$Time), format="%Y-%m-%d %H:%M:%S")
+
#DateTime <- as.POSIXct(paste(temperature$Date, temperature$Time), format="%Y-%m-%d %H:%M:%S")
DateHours <- as.POSIXct(paste(price$Date, price$Hours), format="%Y-%m-%d %H:%M:%S")
+
#DateHours <- as.POSIXct(paste(price$Date, price$Hours), format="%Y-%m-%d %H:%M:%S")
  
 
################## Suomentaja
 
################## Suomentaja
Line 194: Line 203:
 
...
 
...
 
) {
 
) {
 +
cat("This function ograph is depreciated. Use oggplot instead.\n")
 +
 
if(class(ovariable) == "ovariable")  {
 
if(class(ovariable) == "ovariable")  {
 
if(nrow(ovariable@output) == 0) ovariable <- EvalOutput(ovariable)
 
if(nrow(ovariable@output) == 0) ovariable <- EvalOutput(ovariable)
Line 927: Line 938:
 
}
 
}
  
 +
objects.store(list = ls())
 +
cat(paste("All objects in the global namespace were stored.\n"))
  
objects.store(ograph, collapsemarg, MyPointKML, ova2spat, MyRmap, MyPlotKML, truncateIndex, findrest,
 
timing, makeTimeline, timepoints, ana2ova, orbind2, oggplot)
 
 
cat(paste("The following objects are stored: ograph, collapsemarg, MyPointKML, ova2spat, MyRmap, MyPlotKML,",
 
"truncateIndex, findrest, timing, makeTimeline, timepoints, ana2ova, orbind2, oggplot.\n"))
 
 
</rcode>
 
</rcode>
  

Revision as of 06:29, 5 September 2015



Question

Which functions are so useful that they should be taken into OpasnetUtils package? This page contains draft function which will be included when they are good enough and found important.

Answer

Call the objects stored by this code from another rode with this command:

objects.latest("Op_en6007", code_name = "answer")

+ Show code

See also

References


Related files

<mfanonymousfilelist></mfanonymousfilelist>