Commit a843aa75 authored by Corson N. Areshenkoff's avatar Corson N. Areshenkoff

Initial commit

parent 53652691
^.*\.Rproj$
^\.Rproj\.user$
.Rproj.user
.Rhistory
.RData
.Ruserdata
Package: openigt
Type: Package
Title: Iowa Gambling Task data from 617 healthy subjects
Version: 0.1.0
Author: Corson N. Areshenkoff
Maintainer: areshenk@protonmail.com
Description: Interface to the open IGT dataset published by Steingroever et al. (2015)
License: Creative Commons Attribution Share Alike 4.0
Encoding: UTF-8
LazyData: true
exportPattern("^[[:alpha:]]+")
# Hello, world!
#
# This is an example function named 'hello'
# which prints 'Hello, world!'.
#
# You can learn more about package authoring with RStudio at:
#
# http://r-pkgs.had.co.nz/
#
# Some useful keyboard shortcuts for package authoring:
#
# Build and Reload Package: 'Ctrl + Shift + B'
# Check Package: 'Ctrl + Shift + E'
# Test Package: 'Ctrl + Shift + T'
hello <- function() {
print("Hello, world!")
}
openigt.query <- function(study = NULL, payoff = NULL,
trials = NULL, age = NULL, trim = F) {
data(igtdata)
if (is.null(study)) {
study <- levels(igtdata$legend$Study)
}
if (is.null(payoff)) {
payoff <- levels(igtdata$legend$Payoff)
}
if (is.null(trials)) {
trials <- range(igtdata$legend$Trials, na.rm = T)
}
if (is.null(age)) {
age.null <- T
age <- range(igtdata$legend$Age, na.rm = T)
} else {
age.null <- F
}
# Get indices
idx <- which(igtdata$legend$Study %in% study &
igtdata$legend$Payoff %in% payoff &
igtdata$legend$Trials >= trials[1] &
igtdata$legend$Trials <= trials[2] &
igtdata$legend$Age >= age[1] &
igtdata$legend$Age <= age[2] |
(age.null & is.na(igtdata$legend$Age)))
# Truncate data, if requested
if (trim) {
n <- 1:min(igtdata$legend$Trials[idx])
} else {
n <- 1:max(igtdata$legend$Trials[idx])
}
data <- list(legend = igtdata$legend[idx,],
win = igtdata$win[idx,n],
loss = igtdata$loss[idx,n],
net = igtdata$net[idx,n],
choice = igtdata$choice[idx,n])
return(data)
}
\name{hello}
\alias{hello}
\title{Hello, World!}
\usage{
hello()
}
\description{
Prints 'Hello, world!'.
}
\examples{
hello()
}
Version: 1.0
RestoreWorkspace: Default
SaveWorkspace: Default
AlwaysSaveHistory: Default
EnableCodeIndexing: Yes
UseSpacesForTab: Yes
NumSpacesForTab: 4
Encoding: UTF-8
RnwWeave: Sweave
LaTeX: pdfLaTeX
AutoAppendNewline: Yes
StripTrailingWhitespace: Yes
BuildType: Package
PackageUseDevtools: Yes
PackageInstallArgs: --no-multiarch --with-keep.source
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment