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

small changes and getting rid of windows lineend

parent 38c4a999
No related merge requests found
......@@ -3,3 +3,4 @@
.RData
.Ruserdata
*.Rproj
inst/doc
......@@ -3,8 +3,14 @@ Type: Package
Title: Various tools to work with choice experiment data in R
Version: 0.1.0
Author: Julian Sagebiel
Maintainer: Julian Sagebiel <yourself@somewhere.net>
Maintainer: Julian Sagebiel <julian.sagebiel@idiv.de>
Description: Most functions are made for use with apollo.
License: What license is it under?
License: MIT
Encoding: UTF-8
LazyData: true
Suggests:
knitr,
rmarkdown
VignetteBuilder: knitr
Imports:
texreg
#' Create sets from given data
#'
#' This function creates sets based on given attributes and choice columns.
#' It groups data by unique rows, calculates counts, and pivots the data for a
#' comprehensive overview.
#'
#' @param .data A data frame or tibble containing the data.
#' @param choice A string specifying the choice column.
#' @param attributes A selection condition for attribute columns (tidyselect compatible).
#' @param uniquerow A string specifying the unique row identifier column.
#' @param prefix A string specifying the prefix for renaming (default is "a").
#' @param delimiter A string specifying the delimiter for renaming (default is "_").
#'
#' @return A list of tibbles representing the sets.
#'
#' @export
#'
#' @examples
#' # Given a package dataset 'sample_data':
#' createSets(sample_data, choice = "choice_col", attributes = starts_with("attr"), uniquerow = "id")
createSets <- function(.data, choice, attributes , uniquerow, prefix="a") {
require("dplyr")
require("tidyr")
......
# 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:
#
# Install Package: 'Ctrl + Shift + B'
# Check Package: 'Ctrl + Shift + E'
# Test Package: 'Ctrl + Shift + T'
hello <- function() {
print("Hello, world!")
}
# This function lets us create output tables with texreg with objects from Apollo
quicktexregapollo <- function(model =model, wtpest=NULL) {
#' Make your apollo object readable with texreg
#'
#' @param model the name of the apollo model object
#' @param wtpest if you want to display wtp instead of beta coefficients provide a dataframe with the wtp values and standard errors
#'
#' @return a list opject for texreg
#' @export
#'
#' @examples
quicktexregapollo <- function(model = model, wtpest = NULL, se="rob") {
modelOutput_settings = list(printPVal=T)
......@@ -13,9 +22,11 @@ quicktexregapollo <- function(model =model, wtpest=NULL) {
}
coefnames <- gsub(pattern = "_[a-z]$", "" ,rownames(estimated))
texout <- createTexreg(coef.names = coefnames , coef = estimated[["estimate"]] , se = estimated[["rob_s_e"]] , pvalues = estimated$p_1_sided_2,
texout <- texreg::createTexreg(coef.names = coefnames , coef = estimated[["estimate"]] , se = estimated[["rob_s_e"]] , pvalues = estimated$p_1_sided_2,
gof.names = c("No Observations" , "No Respondents" , "Log Likelihood (Null)" , "Log Likelihood (Converged)") ,
gof = c(model[["nObsTot"]] , model[["nIndivs"]], model[["LL0"]][[1]] , model[["LLout"]][[1]] ) ,
gof.decimal = c(FALSE,FALSE,TRUE,TRUE)
......
\name{hello}
\alias{hello}
\title{Hello, World!}
\usage{
hello()
}
\description{
Prints 'Hello, world!'.
}
\examples{
hello()
}
\name{hello}
\alias{hello}
\title{Hello, World!}
\usage{
hello()
}
\description{
Prints 'Hello, world!'.
}
\examples{
hello()
}
*.html
*.R
---
title: "vignette_name"
output: rmarkdown::html_vignette
vignette: >
%\VignetteIndexEntry{vignette_name}
%\VignetteEngine{knitr::rmarkdown}
%\VignetteEncoding{UTF-8}
---
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>"
)
```
```{r setup}
library(choiceTools)
```
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment