-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1d00617
commit 55d0fea
Showing
13 changed files
with
293 additions
and
101 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,9 @@ | ||
^freesurfer\.lme\.Rproj$ | ||
^neuromat\.Rproj$ | ||
^\.Rproj\.user$ | ||
^LICENSE\.md$ | ||
^README\.Rmd$ | ||
^\.github$ | ||
^_pkgdown\.yml$ | ||
^docs$ | ||
^pkgdown$ | ||
^man-roxygen$ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,26 @@ | ||
Package: freesurfer.lme | ||
Title: Create Freesurfer QDEC Files for Linear Mixed Effects Models | ||
Package: neuromat | ||
Title: Create Model Matrices for Neuroimaging Analyses | ||
Version: 0.0.0.9000 | ||
Authors@R: | ||
person("Athanasia Mo", "Mowinckel", , "a.m.mowinckel@psykologi.uio.no", role = c("aut", "cre"), | ||
comment = c(ORCID = "0000-0002-5756-0223")) | ||
Description: Running vertex-wise linear mixed effects models | ||
in Freesurfer <https: https://surfer.nmr.mgh.harvard.edu/fswiki/LinearMixedEffectsModels> requires a specific file format. This package | ||
provides functions to create these files from R. | ||
person( | ||
given = "Athanasia Mo", | ||
family = "Mowinckel", | ||
email = "a.m.mowinckel@psykologi.uio.no", | ||
role = c("aut", "cre"), | ||
comment = c(ORCID = "0000-0002-5756-0223")) | ||
Description: Neuroimaging software often requires the specification | ||
of model matrices to run analyses. These can be difficult to | ||
correctly. This package helps neuroscientists to create such | ||
This includes creating qdec-files for Freesurfer Linear Mixes | ||
Effects models. | ||
License: MIT + file LICENSE | ||
Encoding: UTF-8 | ||
Roxygen: list(markdown = TRUE) | ||
RoxygenNote: 7.2.3 | ||
Imports: | ||
grDevices, | ||
methods, | ||
stats, | ||
utils | ||
URL: https://github.com/capro-uio/freesurfer.lme, http://www.capro.dev/freesurfer.lme/ | ||
BugReports: https://github.com/capro-uio/freesurfer.lme/issues | ||
URL: https://github.com/capro-uio/neuromat, http://www.capro.dev/neuromat/ | ||
BugReports: https://github.com/capro-uio/neuromat/issues |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,11 @@ | ||
# Generated by roxygen2: do not edit by hand | ||
|
||
export(make_qdec) | ||
S3method(plot,qdec) | ||
export(make_fs_qdec) | ||
export(qdec) | ||
export(scale_vec) | ||
importFrom(grDevices,hcl.colors) | ||
importFrom(methods,is) | ||
importFrom(stats,heatmap) | ||
importFrom(stats,model.matrix) | ||
importFrom(utils,write.csv) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#' Scale a numeric vector | ||
#' | ||
#' @param x numeric vector to scale | ||
#' @param ... additional arguments to be passed to \code{\link{scale}} | ||
#' | ||
#' @return scaled vector | ||
#' @export | ||
#' @keywords internal | ||
#' @examples | ||
#' scale_vec(1:20) | ||
scale_vec <- function(x, ...) { | ||
# Error if x has more than one dimension | ||
if(!is.null(dim(x))){ | ||
stop("Input `x` must be a vector", call. = FALSE) | ||
} | ||
as.numeric(scale(x, ...)) | ||
} | ||
|
||
scale_num_data <- function(data, formula){ | ||
# scale continuous variables | ||
cl <- sapply(data, class) | ||
dataz <- data[,which(cl %in% "numeric")] | ||
dataz <- apply(dataz, 2, scale_vec) | ||
dataz <- as.data.frame(dataz, check.names = FALSE) | ||
names(dataz) <- paste0(names(dataz), "z") | ||
dataz | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#' @param formula a model \code{\link{formula}} or | ||
#' \code{\link{terms}} object. For simple qdec file, | ||
#' with binary columns for all levels of a factor, | ||
#' make sure to include a formula with \code{-1} to | ||
#' remove the intercept. |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.