Skip to content

Commit

Permalink
version 0.1.2
Browse files Browse the repository at this point in the history
  • Loading branch information
zhiweilin27 authored and cran-robot committed Jan 30, 2024
1 parent 6eb3e58 commit a9a0e31
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 15 deletions.
6 changes: 3 additions & 3 deletions DESCRIPTION
@@ -1,7 +1,7 @@
Package: AnalysisLin
Type: Package
Title: Exploratory Data Analysis
Version: 0.1.1
Version: 0.1.2
Authors@R: person("Zhiwei","Lin", ,"zhiweilin27@gmail.com",role = c("aut", "cre"))
Description: A quick and effective data exploration toolkit. It provides essential features, including a descriptive statistics table for a quick overview of your dataset, interactive distribution plots to visualize variable patterns, Principal Component Analysis for dimensionality reduction and feature analysis, missing value imputation methods, and correlation analysis.
License: MIT + file LICENSE
Expand All @@ -13,8 +13,8 @@ Date: 2024-01-22
Imports: Hmisc, ggplot2, plotly, stats, caret, htmltools, DT, magrittr,
RANN
NeedsCompilation: no
Packaged: 2024-01-29 20:54:24 UTC; zhiweilin
Packaged: 2024-01-29 23:22:03 UTC; zhiweilin
Author: Zhiwei Lin [aut, cre]
Maintainer: Zhiwei Lin <zhiweilin27@gmail.com>
Repository: CRAN
Date/Publication: 2024-01-29 23:30:02 UTC
Date/Publication: 2024-01-30 00:10:10 UTC
6 changes: 3 additions & 3 deletions MD5
@@ -1,17 +1,17 @@
1e0063a4925b39c8122e53c358d9487b *DESCRIPTION
6dd77156072fae964b8822de01e87e80 *DESCRIPTION
c3b8c9073f1743068fe2f3c547e0c7ff *LICENSE
b4a5434c562c8648e792d55ce0c19a43 *NAMESPACE
a21c7c3ae3d9cef58c217e9c01471458 *R/corr_cluster.R
5356ef746be433a3ff2366ba3965f195 *R/corr_matrix.R
9c16bff16268badc869b2b88c46647ca *R/desc_stat.R
42e134c809456c5ff0aebe4a525ffefe *R/dist_plot.R
bef1da2b503fd18c4fe44c9b0f1c8fcf *R/missing_impute.R
56302bffa673b1dcde8b88034e3a21c3 *R/missing_impute.R
e56410d4bd5766bb5a7f5bd9a731bbd4 *R/missing_plot.R
afcb30deea28438f2443705313725278 *R/pca.R
bdded803681d9cfcec4e169cceb68f91 *build/vignette.rds
8b3661f8aa94c6b7965d882234c47ba6 *inst/doc/AnalysisLin-vignette.R
83f6a6f08d16db017df73417a05d5409 *inst/doc/AnalysisLin-vignette.Rmd
66cc689fe743817029783c6a1dee2129 *inst/doc/AnalysisLin-vignette.html
3859658fd8103a38d161cf319fa95cb6 *inst/doc/AnalysisLin-vignette.html
1b31445e9fe9f9247002f3572e3709f2 *man/bar_plot.Rd
a6dbd5a2712c7dcc0386d9970d3900f9 *man/corr_cluster.Rd
1d28772f9290de0899201a19dd09772a *man/corr_matrix.Rd
Expand Down
6 changes: 5 additions & 1 deletion R/missing_impute.R
Expand Up @@ -68,7 +68,11 @@ impute_locf <- function(x) {
impute_mode <- function(x) {
tbl <- table(x)
modes <- tbl[tbl == max(tbl)]
return(as.numeric(names(modes)))
mode_values <- as.numeric(names(modes))
if (length(mode_values) != sum(is.na(x))) {
mode_values <- rep(mode_values, length.out = sum(is.na(x)))
}
return(mode_values)
}

impute_knn <- function(data, k) {
Expand Down
14 changes: 6 additions & 8 deletions inst/doc/AnalysisLin-vignette.html
Expand Up @@ -574,21 +574,19 @@ <h3>Missing Value Imputation</h3>
<li><p><strong>knn</strong>: use k-nearest nerighbor to replace missing
value, k needs to be chosen.</p></li>
</ul>
<div class="sourceCode" id="cb19"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb19-1"><a href="#cb19-1" tabindex="-1"></a><span class="fu">impute_missing</span>(airquality,<span class="at">method=</span><span class="st">&#39;mode&#39;</span>)</span></code></pre></div>
<pre><code>## Warning in col[is.na(col)] &lt;- impute_mode(col): number of items to replace is
## not a multiple of replacement length</code></pre>
<div class="sourceCode" id="cb21"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb21-1"><a href="#cb21-1" tabindex="-1"></a><span class="fu">impute_missing</span>(airquality,<span class="at">method=</span><span class="st">&#39;median&#39;</span>)</span>
<span id="cb21-2"><a href="#cb21-2" tabindex="-1"></a><span class="fu">impute_missing</span>(airquality,<span class="at">method=</span><span class="st">&#39;locf&#39;</span>)</span>
<span id="cb21-3"><a href="#cb21-3" tabindex="-1"></a><span class="fu">impute_missing</span>(airquality,<span class="at">method=</span><span class="st">&#39;knn&#39;</span>,<span class="at">k=</span><span class="dv">5</span>)</span></code></pre></div>
<div class="sourceCode" id="cb19"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb19-1"><a href="#cb19-1" tabindex="-1"></a><span class="fu">impute_missing</span>(airquality,<span class="at">method=</span><span class="st">&#39;mode&#39;</span>)</span>
<span id="cb19-2"><a href="#cb19-2" tabindex="-1"></a><span class="fu">impute_missing</span>(airquality,<span class="at">method=</span><span class="st">&#39;median&#39;</span>)</span>
<span id="cb19-3"><a href="#cb19-3" tabindex="-1"></a><span class="fu">impute_missing</span>(airquality,<span class="at">method=</span><span class="st">&#39;locf&#39;</span>)</span>
<span id="cb19-4"><a href="#cb19-4" tabindex="-1"></a><span class="fu">impute_missing</span>(airquality,<span class="at">method=</span><span class="st">&#39;knn&#39;</span>,<span class="at">k=</span><span class="dv">5</span>)</span></code></pre></div>
</div>
<div id="principle-component-analysis" class="section level3">
<h3>Principle Component Analysis</h3>
<p>Principle Component Analysis can help you to reduce the number of
variables in a dataset. To perform and visualize PCA on some selected
variables</p>
<div class="sourceCode" id="cb22"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb22-1"><a href="#cb22-1" tabindex="-1"></a><span class="fu">pca</span>(mtcars,<span class="at">variance_threshold =</span> <span class="fl">0.9</span>,<span class="at">scale=</span>T)</span></code></pre></div>
<div class="sourceCode" id="cb20"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb20-1"><a href="#cb20-1" tabindex="-1"></a><span class="fu">pca</span>(mtcars,<span class="at">variance_threshold =</span> <span class="fl">0.9</span>,<span class="at">scale=</span>T)</span></code></pre></div>
<p>to visualize the scree plot and biplot</p>
<div class="sourceCode" id="cb23"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb23-1"><a href="#cb23-1" tabindex="-1"></a><span class="fu">pca</span>(mtcars,<span class="at">variance_threshold =</span> <span class="fl">0.9</span>,<span class="at">scale=</span><span class="cn">TRUE</span>,<span class="at">scree_plot=</span><span class="cn">TRUE</span>,<span class="at">biplot=</span><span class="cn">TRUE</span>)</span></code></pre></div>
<div class="sourceCode" id="cb21"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb21-1"><a href="#cb21-1" tabindex="-1"></a><span class="fu">pca</span>(mtcars,<span class="at">variance_threshold =</span> <span class="fl">0.9</span>,<span class="at">scale=</span><span class="cn">TRUE</span>,<span class="at">scree_plot=</span><span class="cn">TRUE</span>,<span class="at">biplot=</span><span class="cn">TRUE</span>)</span></code></pre></div>
</div>
</div>
</div>
Expand Down

0 comments on commit a9a0e31

Please sign in to comment.