Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

multidimensional scaling #29

Merged
merged 18 commits into from
Mar 23, 2024
Merged
22 changes: 15 additions & 7 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@ License: CC BY-NC-SA (see license file)
Imports:
applicable,
baguette,
bestNormalize,
BiocParallel,
bestNormalize,
BiocParallel,
bibtex,
bonsai,
broom,
brulee (>= 0.2.0),
Expand All @@ -22,6 +23,7 @@ Imports:
Cubist,
DALEXtra,
dbarts,
ddalpha,
desirability2,
devtools,
dials,
Expand All @@ -33,13 +35,15 @@ Imports:
e1071,
earth,
embed,
fastICA,
finetune,
future,
GA,
gifski,
gganimate,
ggforce,
ggiraph,
ggplot2,
gifski,
glmnet,
gt,
hardhat (>= 1.2.0.9000),
Expand All @@ -52,15 +56,15 @@ Imports:
klaR,
knitr,
lightgbm,
magick,
magick,
mda,
mgcv,
mixOmics,
modeldata (>= 1.3.0),
modeldatatoo,
pak,
parallel,
pamr,
parallel,
parsnip,
partykit,
patchwork,
Expand All @@ -74,10 +78,12 @@ Imports:
recipes,
rpart,
rsample,
RSpectra,
rstudioapi,
rsvg,
rules,
sessioninfo,
shinylive,
sparsediscrim,
sparseLDA,
spatialsample,
Expand All @@ -95,15 +101,17 @@ Imports:
torch (>= 0.9.0),
tune,
usethis,
uwot,
VBsparsePCA,
viridis,
waldo,
workflows,
workflowsets,
xfun,
xgboost,
xrf,
yardstick (>= 1.1.0.9000),
yaml
yaml,
yardstick (>= 1.1.0.9000)
Suggests:
testthat (>= 3.0.0)
Remotes:
Expand Down
29 changes: 19 additions & 10 deletions R/setup_chemometrics.R
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,23 @@ chimiometrie_2019 <-
data_chimiometrie_2019() %>%
select(-soy_oil, -lucerne)

set.seed(87)
barley_split <-
initial_split(chimiometrie_2019,
prop = 1 - (500 / nrow(chimiometrie_2019)))
barley_not_test <- training(barley_split)
barley_test <- testing(barley_split)
barley_breaks <- (0:27) * 2

set.seed(2323)
barley_rs <- validation_split(barley_not_test, prop = 1 - (500 / nrow(barley_not_test)))
barley_train <- analysis(barley_rs$splits[[1]])
barley_val <- assessment(barley_rs$splits[[1]])
set.seed(101)
barley_split <- initial_validation_split(chimiometrie_2019, prop = c(0.7, 0.15), strata = barley)
barley_train <- training(barley_split)
barley_val <- validation(barley_split)
barley_test <- testing(barley_split)
barley_rs <- validation_set(barley_split)

wave <- tibble(index = 1:550, wavelength = seq(1300, 2398, by = 2))
wave_corr <-
barley_train %>%
select(starts_with("wv")) %>%
cor()
wave_corr <- wave_corr[upper.tri(wave_corr)]

chimiometrie_2019$barley_bin <-
cut(chimiometrie_2019$barley,
breaks = barley_breaks,
include.lowest = TRUE)
Binary file added RData/umap_results.RData
Binary file not shown.
126 changes: 126 additions & 0 deletions _extensions/quarto-ext/shinylive/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
# Shinylive package methods

## Methods

### R

Interaction:

```
Rscript -e 'shinylive:::quarto_ext()' [methods] [args]
```

### Python

Interaction:

```
shinylive [methods] [args]
```

## CLI Methods

* `extension info`
* Package, version, asset version, and script paths information
* `extension base-htmldeps`
* Quarto html dependencies for the base shinylive integration
* `extension language-resources`
* Language specific resource files for the quarto html dependency named `shinylive`
* `extension app-resources`
* App specific resource files for the quarto html dependency named `shinylive`

### CLI Interface
* `extension info`
* Prints information about the extension including:
* `version`: The version of the R package
* `assets_version`: The version of the web assets
* `scripts`: A list of paths scripts that are used by the extension,
mainly `codeblock-to-json`
* Example
```
{
"version": "0.1.0",
"assets_version": "0.2.0",
"scripts": {
"codeblock-to-json": "/<ASSETS_CACHE_DIR>/shinylive-0.2.0/scripts/codeblock-to-json.js"
}
}
```
* `extension base-htmldeps`
* Prints the language agnostic quarto html dependencies as a JSON array.
* The first html dependency is the `shinylive` service workers.
* The second html dependency is the `shinylive` base dependencies. This
dependency will contain the core `shinylive` asset scripts (JS files
automatically sourced), stylesheets (CSS files that are automatically
included), and resources (additional files that the JS and CSS files can
source).
* Example
```
[
{
"name": "shinylive-serviceworker",
"version": "0.2.0",
"meta": { "shinylive:serviceworker_dir": "." },
"serviceworkers": [
{
"source": "/<ASSETS_CACHE_DIR>/shinylive-0.2.0/shinylive-sw.js",
"destination": "/shinylive-sw.js"
}
]
},
{
"name": "shinylive",
"version": "0.2.0",
"scripts": [{
"name": "shinylive/load-shinylive-sw.js",
"path": "/<ASSETS_CACHE_DIR>/shinylive-0.2.0/shinylive/load-shinylive-sw.js",
"attribs": { "type": "module" }
}],
"stylesheets": [{
"name": "shinylive/shinylive.css",
"path": "/<ASSETS_CACHE_DIR>/shinylive-0.2.0/shinylive/shinylive.css"
}],
"resources": [
{
"name": "shinylive/shinylive.js",
"path": "/<ASSETS_CACHE_DIR>/shinylive-0.2.0/shinylive/shinylive.js"
},
... # [ truncated ]
]
}
]
```
* `extension language-resources`
* Prints the language-specific resource files as JSON that should be added to the quarto html dependency.
* For r-shinylive, this includes the webr resource files
* For py-shinylive, this includes the pyodide and pyright resource files.
* Example
```
[
{
"name": "shinylive/webr/esbuild.d.ts",
"path": "/<ASSETS_CACHE_DIR>/shinylive-0.2.0/shinylive/webr/esbuild.d.ts"
},
{
"name": "shinylive/webr/libRblas.so",
"path": "/<ASSETS_CACHE_DIR>/shinylive-0.2.0/shinylive/webr/libRblas.so"
},
... # [ truncated ]
]
* `extension app-resources`
* Prints app-specific resource files as JSON that should be added to the `"shinylive"` quarto html dependency.
* Currently, r-shinylive does not return any resource files.
* Example
```
[
{
"name": "shinylive/pyodide/anyio-3.7.0-py3-none-any.whl",
"path": "/<ASSETS_CACHE_DIR>/shinylive-0.2.0/shinylive/pyodide/anyio-3.7.0-py3-none-any.whl"
},
{
"name": "shinylive/pyodide/appdirs-1.4.4-py2.py3-none-any.whl",
"path": "/<ASSETS_CACHE_DIR>/shinylive-0.2.0/shinylive/pyodide/appdirs-1.4.4-py2.py3-none-any.whl"
},
... # [ truncated ]
]
```
8 changes: 8 additions & 0 deletions _extensions/quarto-ext/shinylive/_extension.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
name: shinylive
title: Embedded Shinylive applications
author: Winston Chang
version: 0.1.0
quarto-required: ">=1.2.198"
contributes:
filters:
- shinylive.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
div.output-content,
div.shinylive-wrapper {
background-color: rgba(250, 250, 250, 0.65);
border: 1px solid rgba(233, 236, 239, 0.65);
border-radius: 0.5rem;
box-shadow: 0px 1px 2px rgba(0, 0, 0, 0.04), 0px 3px 7px rgba(0, 0, 0, 0.04),
0px 12px 30px rgba(0, 0, 0, 0.07);
margin-top: 32px;
margin-bottom: 32px;
}

div.shinylive-wrapper {
margin: 1em 0;
border-radius: 8px;
}

.shinylive-container {
background-color: #eeeff2;
min-height: auto;
}

.shinylive-container > div {
box-shadow: none;
}

.editor-container .cm-editor .cm-scroller {
font-size: 13px;
line-height: 1.5;
}

iframe.app-frame {
/* Override the default margin from Bootstrap */
margin-bottom: 0;
}
Loading