Skip to content
Snippets Groups Projects
Commit c5d2a367 authored by dj44vuri's avatar dj44vuri
Browse files

initial commit, only one function

parent bac00966
Branches
No related tags found
No related merge requests found
^DCEsim\.Rproj$
^\.Rproj\.user$
^LICENSE\.md$
options(prompt = prompt::prompt_git() )
install.packages("prompt")
options(prompt = prompt::prompt_git() )
usethis::edit_r_profile()
options(prompt = prompt::prompt_git() )
options(prompt = "hello" )
asdf
options(prompt = prompt::prompt_git() )
fasjh
prompt::prompt_git()
git_branch()
prompt::prompt_git(git_branch())
prompt::git_branch()
usethis::edit_r_profile()
options(prompt = prompt::git_branch() )
options(prompt = paste0(prompt::git_branch(), "> ") )
options(prompt = paste0(prompt::git_branch(), " > ") )
if (interactive()) prompt::set_prompt(prompt::prompt_git))
if (interactive()) prompt::set_prompt(prompt::prompt_git)
if (interactive()) prompt::set_prompt(prompt::prompt_git)
devtools::check()
devtools::load_all
devtools::load_all()
.Rproj.user
Version: 1.0
RestoreWorkspace: No
SaveWorkspace: No
AlwaysSaveHistory: Default
EnableCodeIndexing: Yes
UseSpacesForTab: Yes
NumSpacesForTab: 2
Encoding: UTF-8
RnwWeave: Sweave
LaTeX: pdfLaTeX
AutoAppendNewline: Yes
StripTrailingWhitespace: Yes
LineEndingConversion: Posix
BuildType: Package
PackageUseDevtools: Yes
PackageInstallArgs: --no-multiarch --with-keep.source
PackageRoxygenize: rd,collate,namespace
Package: simulateDCE
Title: Simulate data for discrete choice experiments
Version: 0.0.0.9000
Authors@R:
person("Julian", "Sagebiel", , "julian.sagebiel@idiv.de", role = c("aut", "cre"),
comment = c(ORCID = "YOUR-ORCID-ID"))
Description: A package that supports simulating choice experiment data for given designs. It helps to quickly test different designs against each other.
License: MIT + file LICENSE
Encoding: UTF-8
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.2.2
Imports:
dplyr,
readr,
stringr,
tidyr
Suggests:
testthat (>= 3.0.0)
Config/testthat/edition: 3
YEAR: 2023
COPYRIGHT HOLDER: simulateDCE authors
# MIT License
Copyright (c) 2023 simulateDCE authors
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
# Generated by roxygen2: do not edit by hand
export(readdesign)
#' Creates a dataframe with the design.
#'
#' @param design The path to a design file
#' @param designtype Is it a design created with ngene or with spdesign. Ngene desings should be stored as the standard .ngd output. spdesign should be the spdesign object design$design
#'
#' @return a dataframe
#' @export
#'
#' @examples \dontrun{readdesign("Projects/test/Designs/firstdesign.ngd", "ngene")}
#'
readdesign <- function(design = designfile, designtype = destype) {
design <- switch(designtype,
"ngene" = readr::read_delim(design,
delim = "\t",
escape_double = FALSE,
trim_ws = TRUE,
col_select = c(-Design, -tidyr::starts_with("...")),
name_repair = "universal", show_col_types = FALSE
) |>
dplyr::filter(!is.na(Choice.situation)),
"spdesign" = as.data.frame(readRDS(design)) |>
dplyr::mutate(Choice.situation = 1:dplyr::n()) |>
dplyr::rename_with(~ stringr::str_replace(., pattern = "_", "\\."), everything()),
stop("Invalid value for design. Please provide either 'ngene' or 'spdesign'.")
)
}
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/readdesign.R
\name{readdesign}
\alias{readdesign}
\title{Creates a dataframe with the design.}
\usage{
readdesign(design = designfile, designtype = destype)
}
\arguments{
\item{design}{The path to a design file}
\item{designtype}{Is it a design created with ngene or with spdesign. Ngene desings should be stored as the standard .ngd output. spdesign should be the spdesign object design$design}
}
\value{
a dataframe
}
\description{
Creates a dataframe with the design.
}
\examples{
\dontrun{readdesign("Projects/test/Designs/firstdesign.ngd", "ngene")}
}
# This file is part of the standard setup for testthat.
# It is recommended that you do not modify it.
#
# Where should you do additional test configuration?
# Learn more about the roles of various files in:
# * https://r-pkgs.org/tests.html
# * https://testthat.r-lib.org/reference/test_package.html#special-files
library(testthat)
library(simulateDCE)
test_check("simulateDCE")
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment