OpasnetUtils/Drafts: Difference between revisions

From Opasnet
Jump to navigation Jump to search
(→‎Timelineplot: some bugs fixed)
Line 1,052: Line 1,052:


timelineplot <- function(ova, noshow=c("Ulos","Out")) {
timelineplot <- function(ova, noshow=c("Ulos","Out")) {
  require(ggplot2)
   resn <- paste0(ova@name,"Result")
   resn <- paste0(ova@name,"Result")
   if(class(ova)=="ovariable") out <- ova@output else out <- ova
   if(class(ova)=="ovariable") out <- ova@output else out <- ova
Line 1,057: Line 1,058:
   # Make sure that data is ordered correcly.
   # Make sure that data is ordered correcly.
   out <- out[order(out$Person, out$Time) , ]
   out <- out[order(out$Person, out$Time) , ]
  out$Row <- 1:nrow(out)
    
    
   # Make endpoint for each task.
   # Make endpoint for each task.
   b <- cbind(out[colnames(out)!="Work"], Work=c(NA,as.character(out$Work)[1:(nrow(out)-1)]))
   b <- cbind(
    out[!colnames(out) %in% c("Work","Row")],
    Work=c(NA,as.character(out$Work)[1:(nrow(out)-1)]),
    Row =c(NA,out$Row[1:(nrow(out)-1)])
  )  
   b$Work[match(unique(b$Person),b$Person)] <- NA
   b$Work[match(unique(b$Person),b$Person)] <- NA
   out <- rbind(out,b)
   out <- rbind(out,b)
   out <- na.omit(out[!out$Work %in% noshow , ])
   out <- na.omit(out[!out$Work %in% noshow , ])
   if(is.numeric(out$Time)) out$Time <- as.POSIXct(out$Time, origin="1970-01-01 00:00:00")
   if(is.numeric(out$Time)) out$Time <- as.POSIXct(out$Time, origin="1970-01-01 00:00:00")
   pl <- ggplot(out, aes(x=Time,y=Person,colour=Work,group=paste0(Person,Work)))+geom_line(size=5)
   pl <- ggplot(out, aes(x=Time,y=Person,colour=Work,group=Row))+geom_line(size=5)
   return(pl)
   return(pl)
}
}

Revision as of 17:05, 1 July 2018



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") # Old version that fetches all objects, depreciated and not updated.
objects.latest("Op_en6007", code_name = "diagnostics") # Functions for ovariable and model diagnostics: ovashapetest, showLoctable, binoptest
objects.latest("Op_en6007", code_name = "webropol") # Functions for operating with Webropol data
objects.latest("Op_en6007", code_name = "miscellaneous") # Functions for various tasks
objects.latest("Op_en6007", code_name = "gis") # Functions for ovariable, KML and Googl maps interactions

Rationale

Calculations

Functions for ovariable diagnostics

showind has problems with get() but this version of code was acceptable [1].

+ Show code

Functions for Webropol data

+ Show code

Miscellaneous functions

+ Show code

Functions for GIS data

+ Show code

Timelineplot

+ Show code

See also

References


Related files

<mfanonymousfilelist></mfanonymousfilelist>