Compare commits

...

7 commits

Author SHA1 Message Date
6c3a2e9340
new ignore
Some checks are pending
pkgdown.yaml / pkgdown (push) Waiting to run
2024-10-10 13:29:32 +02:00
Andreas Gammelgaard Damsbo
cfbf593a05
Delete app/rsconnect/shinyapps.io/agdamsbo directory 2024-10-10 13:28:35 +02:00
a11c759487
rhub init 2024-10-10 13:26:23 +02:00
1851904408
updated 2024-10-10 13:25:09 +02:00
ea768fbba1 all build notes and errors handled 2024-10-10 13:22:40 +02:00
Andreas Gammelgaard Damsbo
9606f4527d
Delete data directory 2024-10-10 12:22:36 +02:00
Andreas Gammelgaard Damsbo
2ca64738ef
Delete data/prioritized_sample.xlsx 2024-10-10 12:20:21 +02:00
18 changed files with 300 additions and 713 deletions

View file

@ -6,7 +6,10 @@
^CODE_OF_CONDUCT\.md$
^app/
^publish_shiny.R
^publish_cran.R
^_pkgdown\.yml$
^docs$
^pkgdown$
^\.github$
^data/prioritized_sample\.xlsx$
^sample_data$

95
.github/workflows/rhub.yaml vendored Normal file
View file

@ -0,0 +1,95 @@
# R-hub's generic GitHub Actions workflow file. It's canonical location is at
# https://github.com/r-hub/actions/blob/v1/workflows/rhub.yaml
# You can update this file to a newer version using the rhub2 package:
#
# rhub::rhub_setup()
#
# It is unlikely that you need to modify this file manually.
name: R-hub
run-name: "${{ github.event.inputs.id }}: ${{ github.event.inputs.name || format('Manually run by {0}', github.triggering_actor) }}"
on:
workflow_dispatch:
inputs:
config:
description: 'A comma separated list of R-hub platforms to use.'
type: string
default: 'linux,windows,macos'
name:
description: 'Run name. You can leave this empty now.'
type: string
id:
description: 'Unique ID. You can leave this empty now.'
type: string
jobs:
setup:
runs-on: ubuntu-latest
outputs:
containers: ${{ steps.rhub-setup.outputs.containers }}
platforms: ${{ steps.rhub-setup.outputs.platforms }}
steps:
# NO NEED TO CHECKOUT HERE
- uses: r-hub/actions/setup@v1
with:
config: ${{ github.event.inputs.config }}
id: rhub-setup
linux-containers:
needs: setup
if: ${{ needs.setup.outputs.containers != '[]' }}
runs-on: ubuntu-latest
name: ${{ matrix.config.label }}
strategy:
fail-fast: false
matrix:
config: ${{ fromJson(needs.setup.outputs.containers) }}
container:
image: ${{ matrix.config.container }}
steps:
- uses: r-hub/actions/checkout@v1
- uses: r-hub/actions/platform-info@v1
with:
token: ${{ secrets.RHUB_TOKEN }}
job-config: ${{ matrix.config.job-config }}
- uses: r-hub/actions/setup-deps@v1
with:
token: ${{ secrets.RHUB_TOKEN }}
job-config: ${{ matrix.config.job-config }}
- uses: r-hub/actions/run-check@v1
with:
token: ${{ secrets.RHUB_TOKEN }}
job-config: ${{ matrix.config.job-config }}
other-platforms:
needs: setup
if: ${{ needs.setup.outputs.platforms != '[]' }}
runs-on: ${{ matrix.config.os }}
name: ${{ matrix.config.label }}
strategy:
fail-fast: false
matrix:
config: ${{ fromJson(needs.setup.outputs.platforms) }}
steps:
- uses: r-hub/actions/checkout@v1
- uses: r-hub/actions/setup-r@v1
with:
job-config: ${{ matrix.config.job-config }}
token: ${{ secrets.RHUB_TOKEN }}
- uses: r-hub/actions/platform-info@v1
with:
token: ${{ secrets.RHUB_TOKEN }}
job-config: ${{ matrix.config.job-config }}
- uses: r-hub/actions/setup-deps@v1
with:
job-config: ${{ matrix.config.job-config }}
token: ${{ secrets.RHUB_TOKEN }}
- uses: r-hub/actions/run-check@v1
with:
job-config: ${{ matrix.config.job-config }}
token: ${{ secrets.RHUB_TOKEN }}

3
.gitignore vendored
View file

@ -5,3 +5,6 @@
.DS_Store
.quarto
docs
data/prioritized_sample.xlsx
sample_data
app/rsconnect

View file

@ -13,30 +13,27 @@ License: GPL (>= 3)
Imports:
dplyr,
ggplot2,
magrittr,
ompr,
ompr.roi,
openxlsx,
openxlsx2,
patchwork,
renv,
ROI,
ROI.plugin.symphony,
shiny,
tidyr,
viridisLite,
shinylive,
httpuv,
here,
cpp11,
ROI.plugin.alabama,
assertthat,
readODS
readODS,
tibble
Suggests:
pak,
usethis,
styler,
roxygen2,
devtools
devtools,
rhub,
here,
cpp11,
renv,
ROI,
ROI.plugin.symphony
Encoding: UTF-8
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.3.2

View file

@ -4,3 +4,4 @@ S3method(plot,prioritized_groups_list)
export(file_extension)
export(grouping_plot)
export(prioritized_grouping)
export(read_input)

View file

@ -16,9 +16,12 @@ utils::globalVariables(c("group", "grp", "i", "j", "value"))
#' @export
#'
#' @examples
#' prioritized_grouping(
#' data=read.csv(here::here("data/prioritized_sample.csv")),
#' pre_grouped=read.csv(here::here("data/pre_grouped.csv"))) |> plot()
#' # prioritized_grouping(
#' # data=read.csv(here::here("data/prioritized_sample.csv")),
#' # pre_grouped=read.csv(here::here("data/pre_grouped.csv"))) |> plot()
#' data.frame(id=paste0("id",1:100),
#' matrix(replicate(100,sample(c(1:5,rep(NA,15)),10)),ncol=10,byrow = TRUE)) |>
#' prioritized_grouping()
prioritized_grouping <-
function(data,
cap_classes = NULL,
@ -191,7 +194,7 @@ prioritized_grouping <-
class(out) <- c("prioritized_groups_list", class(out))
return(out)
invisible(out)
}
#' Assessment performance overview
@ -203,7 +206,7 @@ prioritized_grouping <-
#'
#' @param data A "prioritized_groups_list" class list from
#' 'prioritized_grouping()'
#' @param columns number of columns in plot
#' @param columns number of columns in plot. Default=4.
#' @param overall logical to only print overall groups mean priority/cost
#' @param viridis.option option value passed on to 'viridisLite::viridis'.
#' Default="D".
@ -217,8 +220,11 @@ prioritized_grouping <-
#' #read.csv(here::here("data/prioritized_sample.csv")) |>
#' # prioritized_grouping(cap_classes = sample(4:12, 17, TRUE)) |>
#' # grouping_plot()
#' data.frame(id=paste0("id",1:100),
#' matrix(replicate(100,sample(c(1:5,rep(NA,15)),10)),ncol=10,byrow = TRUE)) |>
#' prioritized_grouping() |> grouping_plot(overall=TRUE)
grouping_plot <- function(data,
columns = NULL,
columns = 4,
overall = FALSE,
viridis.option="D",
viridis.direction=-1) {
@ -286,18 +292,19 @@ grouping_plot <- function(data,
#' Plot extension for easy groupings plot
#'
#' @param data data of class 'prioritized_groups_list'
#' @param x data of class 'prioritized_groups_list'
#' @param ... passed on to 'grouping_plot()'
#'
#' @return ggplot2 list object
#' @export
#'
#' @examples
#' read.csv(here::here("data/prioritized_sample.csv")) |>
#' prioritized_grouping() |>
#' plot(overall = TRUE, viridis.option="D",viridis.direction=-1)
plot.prioritized_groups_list <- function(data, ...) {
grouping_plot(data, ...)
#' # read.csv(here::here("data/prioritized_sample.csv")) |>
#' # prioritized_grouping() |>
#' # plot(overall = TRUE, viridis.option="D",viridis.direction=-1)
#'
plot.prioritized_groups_list <- function(x, ...) {
grouping_plot(x, ...)
}
## Helper function for Shiny
@ -317,3 +324,39 @@ file_extension <- function(filenames) {
filenames, perl = TRUE
)
}
#' Flexible file import based on extension
#'
#' @param file file name
#' @param consider.na character vector of strings to consider as NAs
#'
#' @return tibble
#' @export
#'
#' @examples
#' read_input("https://raw.githubusercontent.com/agdamsbo/cognitive.index.lookup/main/data/sample.csv")
read_input <- function(file, consider.na = c("NA", '""', "")) {
ext <- file_extension(file)
tryCatch(
{
if (ext == "csv") {
df <- utils::read.csv(file = file, na = consider.na)
} else if (ext %in% c("xls", "xlsx")) {
df <- openxlsx2::read_xlsx(file = file, na.strings = consider.na)
} else if (ext == "ods") {
df <- readODS::read_ods(file = file)
} else {
stop("Input file format has to be on of:
'.csv', '.xls', '.xlsx', '.dta' or '.ods'")
}
},
error = function(e) {
# return a safeError if a parsing error occurs
stop(shiny::safeError(e))
}
)
df
}

View file

@ -1,10 +0,0 @@
name: prioritized-grouping
title:
username: agdamsbo
account: agdamsbo
server: shinyapps.io
hostUrl: https://api.shinyapps.io/v1
appId: 12977223
bundleId: 9205937
url: https://agdamsbo.shinyapps.io/prioritized-grouping/
version: 1

View file

@ -22,6 +22,9 @@ utils::globalVariables(c("group", "grp", "i", "j", "value"))
@ -197,7 +200,7 @@ prioritized_grouping <-
class(out) <- c("prioritized_groups_list", class(out))
return(out)
invisible(out)
}
@ -219,12 +222,15 @@ prioritized_grouping <-
grouping_plot <- function(data,
columns = NULL,
columns = 4,
overall = FALSE,
viridis.option="D",
viridis.direction=-1) {
@ -302,8 +308,9 @@ grouping_plot <- function(data,
plot.prioritized_groups_list <- function(data, ...) {
grouping_plot(data, ...)
plot.prioritized_groups_list <- function(x, ...) {
grouping_plot(x, ...)
}
## Helper function for Shiny
@ -325,6 +332,42 @@ file_extension <- function(filenames) {
}
read_input <- function(file, consider.na = c("NA", '""', "")) {
ext <- file_extension(file)
tryCatch(
{
if (ext == "csv") {
df <- utils::read.csv(file = file, na = consider.na)
} else if (ext %in% c("xls", "xlsx")) {
df <- openxlsx2::read_xlsx(file = file, na.strings = consider.na)
} else if (ext == "ods") {
df <- readODS::read_ods(file = file)
} else {
stop("Input file format has to be on of:
'.csv', '.xls', '.xlsx', '.dta' or '.ods'")
}
},
error = function(e) {
# return a safeError if a parsing error occurs
stop(shiny::safeError(e))
}
)
df
}
########
#### Current file: app/server_raw.R
########
@ -341,27 +384,7 @@ server <- function(input, output, session) {
req(input$file1)
# Make laoding dependent of file name extension (file_ext())
ext <- file_extension(input$file1$datapath)
tryCatch(
{
if (ext == "csv") {
df <- utils::read.csv(input$file1$datapath,na.strings = c("NA", '""',""))
} else if (ext %in% c("xls", "xlsx")) {
df <- openxlsx::read.xlsx(input$file1$datapath,na.strings = c("NA", '""',""))
} else if (ext == "ods") {
df <- readODS::read_ods(file = file)
} else {
stop("Input file format has to be on of:
'.csv', '.xls', '.xlsx' or '.ods'")
}
},
error = function(e) {
# return a safeError if a parsing error occurs
stop(safeError(e))
}
)
df <- read_input(input$file1$datapath)
return(df)
})
@ -370,18 +393,7 @@ server <- function(input, output, session) {
# req(input$file2)
# Make laoding dependent of file name extension (file_ext())
if (!is.null(input$file2$datapath)){
ext <- file_extension(input$file2$datapath)
if (ext == "csv") {
df <- utils::read.csv(input$file2$datapath,na.strings = c("NA", '""',""))
} else if (ext %in% c("xls", "xlsx")) {
df <- openxlsx::read.xlsx(input$file2$datapath,na.strings = c("NA", '""',""))
} else if (ext == "ods") {
df <- readODS::read_ods(file = file)
} else {
stop("Input file format has to be on of:
'.csv', '.xls', '.xlsx' or '.ods'")
}
df <- read_input(input$file2$datapath)
return(df)
} else {

View file

@ -10,27 +10,7 @@ server <- function(input, output, session) {
req(input$file1)
# Make laoding dependent of file name extension (file_ext())
ext <- file_extension(input$file1$datapath)
tryCatch(
{
if (ext == "csv") {
df <- utils::read.csv(input$file1$datapath,na.strings = c("NA", '""',""))
} else if (ext %in% c("xls", "xlsx")) {
df <- openxlsx::read.xlsx(input$file1$datapath,na.strings = c("NA", '""',""))
} else if (ext == "ods") {
df <- readODS::read_ods(file = file)
} else {
stop("Input file format has to be on of:
'.csv', '.xls', '.xlsx' or '.ods'")
}
},
error = function(e) {
# return a safeError if a parsing error occurs
stop(safeError(e))
}
)
df <- read_input(input$file1$datapath)
return(df)
})
@ -39,18 +19,7 @@ server <- function(input, output, session) {
# req(input$file2)
# Make laoding dependent of file name extension (file_ext())
if (!is.null(input$file2$datapath)){
ext <- file_extension(input$file2$datapath)
if (ext == "csv") {
df <- utils::read.csv(input$file2$datapath,na.strings = c("NA", '""',""))
} else if (ext %in% c("xls", "xlsx")) {
df <- openxlsx::read.xlsx(input$file2$datapath,na.strings = c("NA", '""',""))
} else if (ext == "ods") {
df <- readODS::read_ods(file = file)
} else {
stop("Input file format has to be on of:
'.csv', '.xls', '.xlsx' or '.ods'")
}
df <- read_input(input$file2$datapath)
return(df)
} else {

View file

@ -1,11 +0,0 @@
"ID","group"
"sub36",16
"sub105",10
"sub112",3
"sub61",15
"sub27",8
"sub78",7
"sub110",1
"sub129",2
"sub109",12
"sub46",14
1 ID group
2 sub36 16
3 sub105 10
4 sub112 3
5 sub61 15
6 sub27 8
7 sub78 7
8 sub110 1
9 sub129 2
10 sub109 12
11 sub46 14

View file

@ -1,134 +0,0 @@
"ID","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q"
"sub1",,,3,,,,,5,,,1,4,,,,2,
"sub2",,,,3,,5,,,,,,1,,2,,,4
"sub3",4,,,,2,,3,,,,,,,,,5,1
"sub4",,,,,2,,5,4,,,,1,,3,,,
"sub5",,,,5,,,2,,4,,1,,,,,3,
"sub6",,4,,,,,,,2,,1,,5,3,,,
"sub7",3,,,,,4,,,,,1,,,,2,5,
"sub8",,,,,2,,4,,1,,3,,,,,5,
"sub9",,3,,,,,,,1,5,,,4,,,,2
"sub10",,,,4,,,,,,3,,,5,,2,1,
"sub11",,5,,4,,,2,,1,,,,,3,,,
"sub12",,,2,5,,,,,,,,,3,4,,,1
"sub13",,,,5,,,,,,,,1,,3,2,,4
"sub14",,3,4,,,5,,,,,,,,,2,,1
"sub15",4,,,,5,,,2,1,,,,,,,,3
"sub16",5,,,2,4,,,,,,1,,,,3,,
"sub17",,4,,,3,1,5,,,,,,,2,,,
"sub18",,,,,1,2,,,3,5,,,,,,4,
"sub19",,,4,,,,3,,1,,2,,,,5,,
"sub20",,,2,,,,1,,,3,4,5,,,,,
"sub21",5,4,,,,2,,,,,1,,,,,,3
"sub22",,,,,1,,3,2,,,5,,,,4,,
"sub23",1,,,,4,,,,,,,,3,,2,,5
"sub24",,,5,,,,,,,,,1,4,2,,3,
"sub25",2,5,,,,3,,,,,,,,,,1,4
"sub26",,2,,5,,,4,,,,,,,,3,,1
"sub27",,,,,3,2,,,5,,,,,4,,1,
"sub28",,,5,,,,,4,,,1,,,2,,3,
"sub29",2,,,,,3,,,1,,5,4,,,,,
"sub30",,,,,,,1,,,4,,3,,,2,,5
"sub31",,,3,,,,,,,5,,1,,4,,,2
"sub32",3,,,,,,,,2,5,,1,,,4,,
"sub33",,2,,,4,,1,5,,,,,,3,,,
"sub34",,,3,1,,,,4,,,5,,,,,,2
"sub35",1,4,,,,,,2,,,,,,,3,5,
"sub36",,5,,3,,4,1,2,,,,,,,,,
"sub37",,,4,,3,,,,,,,1,2,5,,,
"sub38",,,,4,,,,3,,,,2,,1,5,,
"sub39",5,,,,1,4,,2,,,,,,3,,,
"sub40",,,,,4,2,5,1,,,,,,,3,,
"sub41",,1,,,,3,,5,,,,4,2,,,,
"sub42",,,,,,3,,,,,,1,5,,2,,4
"sub43",,,,,,,,,,,1,,3,,4,2,5
"sub44",,4,,,,,,,,,2,,,5,3,,1
"sub45",2,3,,,,,4,,1,,,,,,,,5
"sub46",,3,,,4,,,,,5,1,,,,,,2
"sub47",,2,1,,5,,,,,3,,4,,,,,
"sub48",,2,,,1,3,,,,,5,4,,,,,
"sub49",,,,1,,,,3,,,,2,,,,4,5
"sub50",3,,,,,,,5,,1,,,4,,,2,
"sub51",,,1,3,4,,,,2,,,,,,,5,
"sub52",,,1,,,,,,,4,5,,,,2,3,
"sub53",,,,2,5,,,,,1,,3,,,,4,
"sub54",,,,3,,,,,4,,,1,,2,,5,
"sub55",,,2,,,,4,,,,,,1,3,5,,
"sub56",,,,,,,,,3,,1,5,4,2,,,
"sub57",,,4,,2,,1,,,,,3,,,,,5
"sub58",,3,,,,,,,,,,4,,,1,5,2
"sub59",,,,4,,,1,,3,,5,2,,,,,
"sub60",,,,,,,,2,,,,1,3,5,,4,
"sub61",,,1,,,3,,2,4,,,,,5,,,
"sub62",1,2,,,,,,5,,4,,,,,,3,
"sub63",,2,,,3,,4,,,,,,,5,,,1
"sub64",,,5,,,1,2,,,,3,,,,,,4
"sub65",1,,3,2,,,,,,4,,,5,,,,
"sub66",,,,,,,1,,,,,2,,4,5,,3
"sub67",4,5,,,,,2,,1,,,,,3,,,
"sub68",3,,,2,5,,4,,,1,,,,,,,
"sub69",5,,1,,,,4,,,,,3,,,2,,
"sub70",,2,,,,5,1,,,,3,,4,,,,
"sub71",5,,,,4,2,,1,,,3,,,,,,
"sub72",5,,,4,1,,,,,,3,,,,,2,
"sub73",5,3,,,,,,,4,,,1,,,2,,
"sub74",,5,,2,,3,,,4,,,,,,,,1
"sub75",,,,,,,,,4,1,,5,2,,,,3
"sub76",,1,,,,,2,5,4,,,3,,,,,
"sub77",5,,,,,,3,,,,,,,1,2,,4
"sub78",4,,,,,,1,3,,2,,,,,,5,
"sub79",,,,3,,,,,,,4,1,5,,2,,
"sub80",,2,,,5,4,,,,,,,,,1,3,
"sub81",,,4,,,,2,,1,,,3,,,,,5
"sub82",5,,,,,,,2,4,,,3,,,,,1
"sub83",,2,,,,,4,5,1,,,,,,3,,
"sub84",,,,3,1,,,,,,2,,4,,,5,
"sub85",,,,1,4,,,5,,,,,,,2,,3
"sub86",,,3,,,,,5,1,,,2,4,,,,
"sub87",,,,,2,5,4,,,,,,1,,,3,
"sub88",,,,,,,,,,,,2,3,1,,4,5
"sub89",,,5,2,,,4,,,,,,,1,,3,
"sub90",,5,,1,,,,,,4,,3,,2,,,
"sub91",5,,,,,3,,,4,,2,,,1,,,
"sub92",,,,,,4,,5,,,2,,,,1,3,
"sub93",,,,,1,,,,,4,2,,5,,,3,
"sub94",1,,,,,,2,,,,,,4,5,,,3
"sub95",,,,,4,2,3,,,5,,1,,,,,
"sub96",,5,,2,,,1,,,,,3,,4,,,
"sub97",1,3,,,,,,4,2,,,,,,5,,
"sub98",,,5,,3,,,,,,1,,,2,4,,
"sub99",,,4,,,,,5,,,,,1,3,2,,
"sub100",,2,,,,4,5,,,3,,,1,,,,
"sub101",,3,,1,2,,,,,,4,,,,,,5
"sub102",1,,,2,,5,,,,,,3,,,,4,
"sub103",,3,,,,,5,,1,,,,,2,,,4
"sub104",,5,,4,,1,2,3,,,,,,,,,
"sub105",,,,2,5,,,3,4,,1,,,,,,
"sub106",,,,4,5,3,2,,,,,1,,,,,
"sub107",2,1,3,,,,,,5,,4,,,,,,
"sub108",,,4,,,,,,,1,,,5,,2,,3
"sub109",,4,,,,,,2,1,,,5,,3,,,
"sub110",,,,,3,,,,1,,,,,4,5,,2
"sub111",,,,,,3,,,4,1,,,,,,2,5
"sub112",,1,,,,,,,2,5,,,3,,,4,
"sub113",,,3,,,,,,,,1,5,,4,2,,
"sub114",,,,,1,3,,,,,5,,4,,2,,
"sub115",,1,,,4,2,,,,,3,5,,,,,
"sub116",,2,4,,,3,,5,1,,,,,,,,
"sub117",,,,,,2,,,,4,,1,,5,,3,
"sub118",,4,5,,,1,,,3,,,,,2,,,
"sub119",5,,,3,,,1,,,4,,,2,,,,
"sub120",1,2,4,,,,,,,,,,5,,,,3
"sub121",,2,,,,5,,,,,,1,3,,,,4
"sub122",3,,1,5,,,,,,,,4,,2,,,
"sub123",,1,3,,,,4,5,,,,,,,,2,
"sub124",,,2,,,4,,,,3,,,,,5,,1
"sub125",,,,2,,,,,,,4,1,,5,,,3
"sub126",,,,2,5,,3,,4,,,,,,,1,
"sub127",4,,,,,1,2,,,,,,5,3,,,
"sub128",,,,,1,4,,,,,,3,,,,2,5
"sub129",,,,3,1,2,,4,,,,5,,,,,
"sub130",4,,,,1,,,5,,3,2,,,,,,
"sub131",,,,,1,3,,,,5,2,,,,,,4
"sub132",,,,,2,,5,,,,3,,1,,,,4
"sub133",,4,,,,,,3,,,,,,1,,2,5
1 ID a b c d e f g h i j k l m n o p q
2 sub1 3 5 1 4 2
3 sub2 3 5 1 2 4
4 sub3 4 2 3 5 1
5 sub4 2 5 4 1 3
6 sub5 5 2 4 1 3
7 sub6 4 2 1 5 3
8 sub7 3 4 1 2 5
9 sub8 2 4 1 3 5
10 sub9 3 1 5 4 2
11 sub10 4 3 5 2 1
12 sub11 5 4 2 1 3
13 sub12 2 5 3 4 1
14 sub13 5 1 3 2 4
15 sub14 3 4 5 2 1
16 sub15 4 5 2 1 3
17 sub16 5 2 4 1 3
18 sub17 4 3 1 5 2
19 sub18 1 2 3 5 4
20 sub19 4 3 1 2 5
21 sub20 2 1 3 4 5
22 sub21 5 4 2 1 3
23 sub22 1 3 2 5 4
24 sub23 1 4 3 2 5
25 sub24 5 1 4 2 3
26 sub25 2 5 3 1 4
27 sub26 2 5 4 3 1
28 sub27 3 2 5 4 1
29 sub28 5 4 1 2 3
30 sub29 2 3 1 5 4
31 sub30 1 4 3 2 5
32 sub31 3 5 1 4 2
33 sub32 3 2 5 1 4
34 sub33 2 4 1 5 3
35 sub34 3 1 4 5 2
36 sub35 1 4 2 3 5
37 sub36 5 3 4 1 2
38 sub37 4 3 1 2 5
39 sub38 4 3 2 1 5
40 sub39 5 1 4 2 3
41 sub40 4 2 5 1 3
42 sub41 1 3 5 4 2
43 sub42 3 1 5 2 4
44 sub43 1 3 4 2 5
45 sub44 4 2 5 3 1
46 sub45 2 3 4 1 5
47 sub46 3 4 5 1 2
48 sub47 2 1 5 3 4
49 sub48 2 1 3 5 4
50 sub49 1 3 2 4 5
51 sub50 3 5 1 4 2
52 sub51 1 3 4 2 5
53 sub52 1 4 5 2 3
54 sub53 2 5 1 3 4
55 sub54 3 4 1 2 5
56 sub55 2 4 1 3 5
57 sub56 3 1 5 4 2
58 sub57 4 2 1 3 5
59 sub58 3 4 1 5 2
60 sub59 4 1 3 5 2
61 sub60 2 1 3 5 4
62 sub61 1 3 2 4 5
63 sub62 1 2 5 4 3
64 sub63 2 3 4 5 1
65 sub64 5 1 2 3 4
66 sub65 1 3 2 4 5
67 sub66 1 2 4 5 3
68 sub67 4 5 2 1 3
69 sub68 3 2 5 4 1
70 sub69 5 1 4 3 2
71 sub70 2 5 1 3 4
72 sub71 5 4 2 1 3
73 sub72 5 4 1 3 2
74 sub73 5 3 4 1 2
75 sub74 5 2 3 4 1
76 sub75 4 1 5 2 3
77 sub76 1 2 5 4 3
78 sub77 5 3 1 2 4
79 sub78 4 1 3 2 5
80 sub79 3 4 1 5 2
81 sub80 2 5 4 1 3
82 sub81 4 2 1 3 5
83 sub82 5 2 4 3 1
84 sub83 2 4 5 1 3
85 sub84 3 1 2 4 5
86 sub85 1 4 5 2 3
87 sub86 3 5 1 2 4
88 sub87 2 5 4 1 3
89 sub88 2 3 1 4 5
90 sub89 5 2 4 1 3
91 sub90 5 1 4 3 2
92 sub91 5 3 4 2 1
93 sub92 4 5 2 1 3
94 sub93 1 4 2 5 3
95 sub94 1 2 4 5 3
96 sub95 4 2 3 5 1
97 sub96 5 2 1 3 4
98 sub97 1 3 4 2 5
99 sub98 5 3 1 2 4
100 sub99 4 5 1 3 2
101 sub100 2 4 5 3 1
102 sub101 3 1 2 4 5
103 sub102 1 2 5 3 4
104 sub103 3 5 1 2 4
105 sub104 5 4 1 2 3
106 sub105 2 5 3 4 1
107 sub106 4 5 3 2 1
108 sub107 2 1 3 5 4
109 sub108 4 1 5 2 3
110 sub109 4 2 1 5 3
111 sub110 3 1 4 5 2
112 sub111 3 4 1 2 5
113 sub112 1 2 5 3 4
114 sub113 3 1 5 4 2
115 sub114 1 3 5 4 2
116 sub115 1 4 2 3 5
117 sub116 2 4 3 5 1
118 sub117 2 4 1 5 3
119 sub118 4 5 1 3 2
120 sub119 5 3 1 4 2
121 sub120 1 2 4 5 3
122 sub121 2 5 1 3 4
123 sub122 3 1 5 4 2
124 sub123 1 3 4 5 2
125 sub124 2 4 3 5 1
126 sub125 2 4 1 5 3
127 sub126 2 5 3 4 1
128 sub127 4 1 2 5 3
129 sub128 1 4 3 2 5
130 sub129 3 1 2 4 5
131 sub130 4 1 5 3 2
132 sub131 1 3 5 2 4
133 sub132 2 5 3 1 4
134 sub133 4 3 1 2 5

Binary file not shown.

View file

@ -6,7 +6,7 @@
\usage{
grouping_plot(
data,
columns = NULL,
columns = 4,
overall = FALSE,
viridis.option = "D",
viridis.direction = -1
@ -16,7 +16,7 @@ grouping_plot(
\item{data}{A "prioritized_groups_list" class list from
'prioritized_grouping()'}
\item{columns}{number of columns in plot}
\item{columns}{number of columns in plot. Default=4.}
\item{overall}{logical to only print overall groups mean priority/cost}
@ -39,4 +39,7 @@ in the group.
#read.csv(here::here("data/prioritized_sample.csv")) |>
# prioritized_grouping(cap_classes = sample(4:12, 17, TRUE)) |>
# grouping_plot()
data.frame(id=paste0("id",1:100),
matrix(replicate(100,sample(c(1:5,rep(NA,15)),10)),ncol=10,byrow = TRUE)) |>
prioritized_grouping() |> grouping_plot(overall=TRUE)
}

View file

@ -4,10 +4,10 @@
\alias{plot.prioritized_groups_list}
\title{Plot extension for easy groupings plot}
\usage{
\method{plot}{prioritized_groups_list}(data, ...)
\method{plot}{prioritized_groups_list}(x, ...)
}
\arguments{
\item{data}{data of class 'prioritized_groups_list'}
\item{x}{data of class 'prioritized_groups_list'}
\item{...}{passed on to 'grouping_plot()'}
}
@ -18,7 +18,8 @@ ggplot2 list object
Plot extension for easy groupings plot
}
\examples{
read.csv(here::here("data/prioritized_sample.csv")) |>
prioritized_grouping() |>
plot(overall = TRUE, viridis.option="D",viridis.direction=-1)
# read.csv(here::here("data/prioritized_sample.csv")) |>
# prioritized_grouping() |>
# plot(overall = TRUE, viridis.option="D",viridis.direction=-1)
}

View file

@ -34,7 +34,10 @@ list of custom class 'prioritized_groups_list'
Solve grouping based on priorities or costs.
}
\examples{
prioritized_grouping(
data=read.csv(here::here("data/prioritized_sample.csv")),
pre_grouped=read.csv(here::here("data/pre_grouped.csv"))) |> plot()
# prioritized_grouping(
# data=read.csv(here::here("data/prioritized_sample.csv")),
# pre_grouped=read.csv(here::here("data/pre_grouped.csv"))) |> plot()
data.frame(id=paste0("id",1:100),
matrix(replicate(100,sample(c(1:5,rep(NA,15)),10)),ncol=10,byrow = TRUE)) |>
prioritized_grouping()
}

22
man/read_input.Rd Normal file
View file

@ -0,0 +1,22 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/prioritized_grouping.R
\name{read_input}
\alias{read_input}
\title{Flexible file import based on extension}
\usage{
read_input(file, consider.na = c("NA", "\\"\\"", ""))
}
\arguments{
\item{file}{file name}
\item{consider.na}{character vector of strings to consider as NAs}
}
\value{
tibble
}
\description{
Flexible file import based on extension
}
\examples{
read_input("https://raw.githubusercontent.com/agdamsbo/cognitive.index.lookup/main/data/sample.csv")
}

36
publish_cran.R Normal file
View file

@ -0,0 +1,36 @@
# Checks for publishing
# Rhub v2
# rhub::rhub_setup()
# rhub::rhub_doctor()
rhub::rhub_check(platforms = c(
"linux",
"macos",
"macos-arm64",
"windows"))
# rhub::rhub_setup(overwrite = TRUE)
# rhub::rhub_platforms()
# SPELLING - dont use usethis::use_spell_check() - tests create notes on CRAN - not good
devtools::spell_check()
spelling::update_wordlist()
# Release on CRAN - confirm e-mail
devtools::release()
# Use the following to publish latest release to GitHub
usethis::use_github_release()
## Testing
##
# ds <- data.frame(id=paste0("id",1:100),matrix(replicate(100,sample(c(1:5,rep(NA,15)),10)),ncol=10,byrow = TRUE))
#
# ls <- ds|> prioritized_grouping(seed = 7)
#
# ls$export |> tibble::as.tibble() |> dplyr::right_join(ds,by = c("ID"="id")) |> View()

460
renv.lock
View file

@ -76,33 +76,6 @@
],
"Hash": "42ce9ee4c1cf168869f4386d2cdeadd2"
},
"ROI.plugin.alabama": {
"Package": "ROI.plugin.alabama",
"Version": "1.0-2",
"Source": "Repository",
"Repository": "CRAN",
"Requirements": [
"ROI",
"alabama",
"methods",
"stats",
"utils"
],
"Hash": "097f1b625baf91f0d8999a1385054250"
},
"ROI.plugin.symphony": {
"Package": "ROI.plugin.symphony",
"Version": "1.0-0",
"Source": "Repository",
"Repository": "CRAN",
"Requirements": [
"ROI",
"Rsymphony",
"methods",
"slam"
],
"Hash": "0d5d6f983334cf25a47eef4b293fb299"
},
"Rcpp": {
"Package": "Rcpp",
"Version": "1.0.13",
@ -114,51 +87,6 @@
],
"Hash": "f27411eb6d9c3dada5edd444b8416675"
},
"Rsymphony": {
"Package": "Rsymphony",
"Version": "0.1-33",
"Source": "Repository",
"Repository": "RSPM",
"Requirements": [
"R"
],
"Hash": "3f55239fe534fe91e739c77d99a4ffbf"
},
"alabama": {
"Package": "alabama",
"Version": "2023.1.0",
"Source": "Repository",
"Repository": "CRAN",
"Requirements": [
"R",
"numDeriv"
],
"Hash": "593db7eb170506e6b61ca0c803201924"
},
"archive": {
"Package": "archive",
"Version": "1.1.9",
"Source": "Repository",
"Repository": "RSPM",
"Requirements": [
"R",
"cli",
"glue",
"rlang",
"tibble"
],
"Hash": "d26b62e131d4a8b65aba4e9554a4bf74"
},
"askpass": {
"Package": "askpass",
"Version": "1.2.1",
"Source": "Repository",
"Repository": "CRAN",
"Requirements": [
"sys"
],
"Hash": "c39f4155b3ceb1a9a2799d700fbd4b6a"
},
"assertthat": {
"Package": "assertthat",
"Version": "0.2.1",
@ -189,16 +117,6 @@
],
"Hash": "543776ae6848fde2f48ff3816d0628bc"
},
"brio": {
"Package": "brio",
"Version": "1.1.5",
"Source": "Repository",
"Repository": "CRAN",
"Requirements": [
"R"
],
"Hash": "c1ee497a6d999947c2c224ae46799b1a"
},
"bslib": {
"Package": "bslib",
"Version": "0.8.0",
@ -232,19 +150,6 @@
],
"Hash": "cd9a672193789068eb5a2aad65a0dedf"
},
"callr": {
"Package": "callr",
"Version": "3.7.6",
"Source": "Repository",
"Repository": "RSPM",
"Requirements": [
"R",
"R6",
"processx",
"utils"
],
"Hash": "d7e13f49c19103ece9e58ad2d83a7354"
},
"cellranger": {
"Package": "cellranger",
"Version": "1.1.0",
@ -323,16 +228,6 @@
],
"Hash": "859d96e65ef198fd43e82b9628d593ef"
},
"curl": {
"Package": "curl",
"Version": "5.2.3",
"Source": "Repository",
"Repository": "CRAN",
"Requirements": [
"R"
],
"Hash": "d91263322a58af798f6cf3b13fd56dde"
},
"data.table": {
"Package": "data.table",
"Version": "1.16.0",
@ -344,19 +239,6 @@
],
"Hash": "fb24e05d4a91d8b1c7ff8e284bde834a"
},
"desc": {
"Package": "desc",
"Version": "1.4.3",
"Source": "Repository",
"Repository": "RSPM",
"Requirements": [
"R",
"R6",
"cli",
"utils"
],
"Hash": "99b79fcbd6c4d1ce087f5c5c758b384f"
},
"digest": {
"Package": "digest",
"Version": "0.6.37",
@ -417,16 +299,6 @@
"Repository": "RSPM",
"Hash": "aa5e1cd11c2d15497494c5292d7ffcc8"
},
"filelock": {
"Package": "filelock",
"Version": "1.0.3",
"Source": "Repository",
"Repository": "RSPM",
"Requirements": [
"R"
],
"Hash": "192053c276525c8495ccfd523aa8f2d1"
},
"fontawesome": {
"Package": "fontawesome",
"Version": "0.5.2",
@ -486,34 +358,6 @@
],
"Hash": "44c6a2f8202d5b7e878ea274b1092426"
},
"gh": {
"Package": "gh",
"Version": "1.4.1",
"Source": "Repository",
"Repository": "RSPM",
"Requirements": [
"R",
"cli",
"gitcreds",
"glue",
"httr2",
"ini",
"jsonlite",
"lifecycle",
"rlang"
],
"Hash": "fbbbc48eba7a6626a08bb365e44b563b"
},
"gitcreds": {
"Package": "gitcreds",
"Version": "0.1.2",
"Source": "Repository",
"Repository": "RSPM",
"Requirements": [
"R"
],
"Hash": "ab08ac61f3e1be454ae21911eb8bc2fe"
},
"glue": {
"Package": "glue",
"Version": "1.8.0",
@ -540,30 +384,6 @@
],
"Hash": "e18861963cbc65a27736e02b3cd3c4a0"
},
"here": {
"Package": "here",
"Version": "1.0.1",
"Source": "Repository",
"Repository": "RSPM",
"Requirements": [
"rprojroot"
],
"Hash": "24b224366f9c2e7534d2344d10d59211"
},
"hms": {
"Package": "hms",
"Version": "1.1.3",
"Source": "Repository",
"Repository": "RSPM",
"Requirements": [
"lifecycle",
"methods",
"pkgconfig",
"rlang",
"vctrs"
],
"Hash": "b59377caa7ed00fa41808342002138f9"
},
"htmltools": {
"Package": "htmltools",
"Version": "0.5.8.1",
@ -595,34 +415,6 @@
],
"Hash": "d55aa087c47a63ead0f6fc10f8fa1ee0"
},
"httr2": {
"Package": "httr2",
"Version": "1.0.5",
"Source": "Repository",
"Repository": "RSPM",
"Requirements": [
"R",
"R6",
"cli",
"curl",
"glue",
"lifecycle",
"magrittr",
"openssl",
"rappdirs",
"rlang",
"vctrs",
"withr"
],
"Hash": "d84e4c33206aaace37714901ac2b00c3"
},
"ini": {
"Package": "ini",
"Version": "0.3.1",
"Source": "Repository",
"Repository": "CRAN",
"Hash": "6154ec2223172bce8162d4153cda21f7"
},
"isoband": {
"Package": "isoband",
"Version": "0.2.7",
@ -725,13 +517,6 @@
],
"Hash": "4062982514dd797c7013124da49994c8"
},
"lpSolve": {
"Package": "lpSolve",
"Version": "5.6.21",
"Source": "Repository",
"Repository": "RSPM",
"Hash": "730a90bdc519fb0caff03df11218ddd8"
},
"magrittr": {
"Package": "magrittr",
"Version": "2.0.3",
@ -817,16 +602,6 @@
],
"Hash": "ccbb8846be320b627e6aa2b4616a2ded"
},
"numDeriv": {
"Package": "numDeriv",
"Version": "2016.8-1.1",
"Source": "Repository",
"Repository": "CRAN",
"Requirements": [
"R"
],
"Hash": "df58958f293b166e4ab885ebcad90e02"
},
"ompr": {
"Package": "ompr",
"Version": "1.0.4",
@ -859,32 +634,22 @@
],
"Hash": "0f9f0bb7e9cff9da0237c8bd206d40a2"
},
"openssl": {
"Package": "openssl",
"Version": "2.2.2",
"openxlsx2": {
"Package": "openxlsx2",
"Version": "1.9",
"Source": "Repository",
"Repository": "RSPM",
"Requirements": [
"askpass"
],
"Hash": "d413e0fef796c9401a4419485f709ca1"
},
"openxlsx": {
"Package": "openxlsx",
"Version": "4.2.7.1",
"Source": "Repository",
"Repository": "RSPM",
"Repository": "CRAN",
"Requirements": [
"R",
"R6",
"Rcpp",
"grDevices",
"methods",
"stats",
"magrittr",
"stringi",
"utils",
"zip"
],
"Hash": "14304e44a0f90fa2d0f905472333c561"
"Hash": "f3e00e7d16abb500e63faee67b7dc1a7"
},
"patchwork": {
"Package": "patchwork",
@ -922,40 +687,6 @@
],
"Hash": "15da5a8412f317beeee6175fbc76f4bb"
},
"pkgbuild": {
"Package": "pkgbuild",
"Version": "1.4.4",
"Source": "Repository",
"Repository": "RSPM",
"Requirements": [
"R",
"R6",
"callr",
"cli",
"desc",
"processx"
],
"Hash": "a29e8e134a460a01e0ca67a4763c595b"
},
"pkgcache": {
"Package": "pkgcache",
"Version": "2.2.3",
"Source": "Repository",
"Repository": "CRAN",
"Requirements": [
"R",
"R6",
"callr",
"cli",
"curl",
"filelock",
"jsonlite",
"processx",
"tools",
"utils"
],
"Hash": "502554da4ec4d917b737e6b0fe14dd11"
},
"pkgconfig": {
"Package": "pkgconfig",
"Version": "2.0.3",
@ -966,68 +697,6 @@
],
"Hash": "01f28d4278f15c76cddbea05899c5d6f"
},
"pkgdepends": {
"Package": "pkgdepends",
"Version": "0.8.0",
"Source": "Repository",
"Repository": "RSPM",
"Requirements": [
"R",
"R6",
"callr",
"cli",
"curl",
"desc",
"filelock",
"jsonlite",
"lpSolve",
"pkgbuild",
"pkgcache",
"processx",
"ps",
"stats",
"utils",
"zip"
],
"Hash": "eb7e3e965327555a527196d26d0643e4"
},
"prettyunits": {
"Package": "prettyunits",
"Version": "1.2.0",
"Source": "Repository",
"Repository": "CRAN",
"Requirements": [
"R"
],
"Hash": "6b01fc98b1e86c4f705ce9dcfd2f57c7"
},
"processx": {
"Package": "processx",
"Version": "3.8.4",
"Source": "Repository",
"Repository": "CRAN",
"Requirements": [
"R",
"R6",
"ps",
"utils"
],
"Hash": "0c90a7d71988856bad2a2a45dd871bb9"
},
"progress": {
"Package": "progress",
"Version": "1.2.3",
"Source": "Repository",
"Repository": "CRAN",
"Requirements": [
"R",
"R6",
"crayon",
"hms",
"prettyunits"
],
"Hash": "f4625e061cb2865f111b47ff163a5ca6"
},
"promises": {
"Package": "promises",
"Version": "1.3.0",
@ -1044,32 +713,6 @@
],
"Hash": "434cd5388a3979e74be5c219bcd6e77d"
},
"ps": {
"Package": "ps",
"Version": "1.8.0",
"Source": "Repository",
"Repository": "RSPM",
"Requirements": [
"R",
"utils"
],
"Hash": "4b9c8485b0c7eecdf0a9ba5132a45576"
},
"purrr": {
"Package": "purrr",
"Version": "1.0.2",
"Source": "Repository",
"Repository": "CRAN",
"Requirements": [
"R",
"cli",
"lifecycle",
"magrittr",
"rlang",
"vctrs"
],
"Hash": "1cba04a4e9414bdefc9dcaa99649a8dc"
},
"rappdirs": {
"Package": "rappdirs",
"Version": "0.3.3",
@ -1136,16 +779,6 @@
],
"Hash": "3eec01f8b1dee337674b2e34ab1f9bc1"
},
"rprojroot": {
"Package": "rprojroot",
"Version": "2.0.4",
"Source": "Repository",
"Repository": "RSPM",
"Requirements": [
"R"
],
"Hash": "4c8415e0ec1e29f3f4f6fc108bef0144"
},
"sass": {
"Package": "sass",
"Version": "0.4.9",
@ -1213,31 +846,6 @@
],
"Hash": "6a293995a66e12c48d13aa1f957d09c7"
},
"shinylive": {
"Package": "shinylive",
"Version": "0.2.0",
"Source": "Repository",
"Repository": "CRAN",
"Requirements": [
"archive",
"brio",
"cli",
"fs",
"gh",
"glue",
"httr2",
"jsonlite",
"pkgdepends",
"progress",
"rappdirs",
"renv",
"rlang",
"tools",
"whisker",
"withr"
],
"Hash": "224c8c0502bb0ead1fd1b4b32ea04a90"
},
"slam": {
"Package": "slam",
"Version": "0.1-53",
@ -1272,30 +880,6 @@
],
"Hash": "39e1144fd75428983dc3f63aa53dfa91"
},
"stringr": {
"Package": "stringr",
"Version": "1.5.1",
"Source": "Repository",
"Repository": "CRAN",
"Requirements": [
"R",
"cli",
"glue",
"lifecycle",
"magrittr",
"rlang",
"stringi",
"vctrs"
],
"Hash": "960e2ae9e09656611e0b8214ad543207"
},
"sys": {
"Package": "sys",
"Version": "3.4.3",
"Source": "Repository",
"Repository": "RSPM",
"Hash": "de342ebfebdbf40477d0758d05426646"
},
"tibble": {
"Package": "tibble",
"Version": "3.2.1",
@ -1315,29 +899,6 @@
],
"Hash": "a84e2cc86d07289b3b6f5069df7a004c"
},
"tidyr": {
"Package": "tidyr",
"Version": "1.3.1",
"Source": "Repository",
"Repository": "CRAN",
"Requirements": [
"R",
"cli",
"cpp11",
"dplyr",
"glue",
"lifecycle",
"magrittr",
"purrr",
"rlang",
"stringr",
"tibble",
"tidyselect",
"utils",
"vctrs"
],
"Hash": "915fb7ce036c22a6a33b5a8adb712eb1"
},
"tidyselect": {
"Package": "tidyselect",
"Version": "1.2.1",
@ -1399,13 +960,6 @@
],
"Hash": "c826c7c4241b6fc89ff55aaea3fa7491"
},
"whisker": {
"Package": "whisker",
"Version": "0.4.1",
"Source": "Repository",
"Repository": "RSPM",
"Hash": "c6abfa47a46d281a7d5159d0a8891e88"
},
"withr": {
"Package": "withr",
"Version": "3.0.1",