#-------------------------------------------------------------------------#
# opentick R package, copyright (C) Joshua M. Ulrich, 2007-2008 #
# Distributed under GNU GPL version 3 #
#-------------------------------------------------------------------------#
#'getMAC' <- function()
'getOS' <-
function() {
os <- OT$OS_UNKNOWN
osStr <- sessionInfo()$R.version$os
# This is probably a bug-prone way to determine the OS...
# but it works for me ;)
if( regexpr('.*(nux|nix|osx).*', osStr, TRUE)>0 ) {
os <- OT$OS_LINUX
} else if( regexpr('.*XP.*', osStr)>0 ) {
os <- OT$OS_WINXP
} else if( regexpr('.*2000.*', osStr)>0 ) {
os <- OT$OS_WIN2000
} else if( regexpr('.*NT.*', osStr)>0 ) {
os <- OT$OS_WINNT
} else if( regexpr('.*Mill.*', osStr)>0 ) {
os <- OT$OS_WINME
} else if( regexpr('.*98SE.*', osStr)>0 ) {
os <- OT$OS_WIN98SE
} else if( regexpr('.*98.*', osStr)>0 ) {
os <- OT$OS_WIN98
} else if( regexpr('.*95.*', osStr)>0 ) {
os <- OT$OS_WIN95
}
return(os)
}
'getRequestID' <-
function() {
x <- getParams()
x$requestID <- x$requestID + 1
setParams(x)
return(x$requestID)
}
'getSocket' <- function() {
x <- get('.otConnection',as.environment("package:opentick"))
}
'getParams' <- function() {
x <- get('.otParams',as.environment("package:opentick"))
}
'setParams' <- function(x) {
# Get environment
env <- as.environment("package:opentick")
environment(x) <- env
# Check if binding locked; unlock if needed
locked <- bindingIsLocked('.otParams', env)
if(locked) {
unlockBinding('.otParams', env)
}
# Assign new parameter to object
#assign('.otParams', { otp <- get('.otParams'); otp[param] <- value; otp }, env )
assign('.otParams', x, env)
# Re-lock, if needed
if(locked) {
suppressWarnings({
lockBinding('.otParams', env)
})
}
return(invisible(1))
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.