Skip to content

Commit

Permalink
Merge pull request #126 from SMAC-Group/imu_print
Browse files Browse the repository at this point in the history
Imu print
  • Loading branch information
coatless committed Feb 5, 2016
2 parents 1c954c0 + 19d7b9e commit efff65a
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 17 deletions.
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

S3method("*",ts.model)
S3method("+",ts.model)
S3method("[",imu)
S3method(autoplot,auto.imu)
S3method(autoplot,gmwm)
S3method(autoplot,gmwm1)
Expand Down
2 changes: 1 addition & 1 deletion R/data_install.R
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ install_imudata = function(type="ONL",loc=NULL){
type = toupper(type)

if(type == "ONL"){
install.packages("imudata")
install.packages("imudata", repos = "http://smac-group.com/datarepo")
}else{
if(!is.null(loc)){
message("Installing the package using a local .tar file.")
Expand Down
18 changes: 11 additions & 7 deletions R/imu.R
Original file line number Diff line number Diff line change
Expand Up @@ -206,10 +206,11 @@ create_imu = function(data, ngyros, nacces, axis, freq, unit = NULL, name = NULL
#' Subset an IMU Object
#'
#' Enables the IMU object to be subsettable. That is, you can load all the data in and then select certain properties.
#'
#' @param x A \code{imu} object
#' @param i A \code{integer vector} that specifies the rows to subset. If blank, all rows are selected.
#' @param j A \code{integer vector} that specifies the columns to subset. Special rules apply see details.
#' @export
#' @param x A \code{imu} object
#' @param i A \code{integer vector} that specifies the rows to subset. If blank, all rows are selected.
#' @param j A \code{integer vector} that specifies the columns to subset. Special rules apply see details.
#' @param drop A \code{boolean} indicating whether the structure should be preserved or simplified.
#' @return An \code{imu} object class.
#' @details
#' When using the subset operator, note that all the Gyroscopes are placed at the front of object
Expand All @@ -225,7 +226,6 @@ create_imu = function(data, ngyros, nacces, axis, freq, unit = NULL, name = NULL
#' }
#' \item The column names are the default cast. (Backend)
#' }
#'
#' @examples
#' \dontrun{
#' if(!require("imudata")){
Expand All @@ -252,7 +252,7 @@ create_imu = function(data, ngyros, nacces, axis, freq, unit = NULL, name = NULL
#'
#' }
#'
'[.imu' = function(x, i, j){
'[.imu' = function(x, i, j, drop = FALSE){

axis = attr(x,"axis")
sensor = attr(x,"sensor")
Expand Down Expand Up @@ -286,6 +286,10 @@ create_imu = function(data, ngyros, nacces, axis, freq, unit = NULL, name = NULL
num.sensor = c({if(!is.na(ng["Gyro"])) ng["Gyro"] else 0}, {if(!is.na(ng["Accel"])) ng["Accel"] else 0})
}

if(drop){
return(NextMethod("[", drop = TRUE))
}

create_imu(NextMethod("[", drop = FALSE),
num.sensor[1], num.sensor[2], axis, attr(x,"freq"), attr(x,"unit"), attr(x,"name"), attr(x,"stype"))

Expand Down Expand Up @@ -754,7 +758,7 @@ autoplot.imu2 = function(object, CI = T, background = 'white', transparence = 0.
legend.title = 'Axis', legend.key.size = 1.3, legend.title.size = 13,
legend.text.size = 13, facet.label.background = "#003C7D33", scales = "free_y", ...){

value=low=high=WV=.x=NULL
value=low=high=WV=.x=axis=NULL

# S1: Checking statement (Reset it to default setting if user passes wrong values)
if( !(background %in% c('grey','gray', 'white')) ){
Expand Down
8 changes: 0 additions & 8 deletions R/onload.R
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,4 @@
}
packageStartupMessage('Check for updates and report bugs at https://github.com/SMAC-Group/gmwm')
packageStartupMessage('To see the user guides use browseVignettes("gmwm").')
}


.onLoad <- function(libname, pkgname) {
repos = getOption("repos")
repos["SMAC"]="http://smac-group.com/datarepo"
options(repos = repos)
invisible(repos)
}
4 changes: 3 additions & 1 deletion man/sub-.imu.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit efff65a

Please sign in to comment.