inst/doc/mmstat4.R

## ----include = FALSE----------------------------------------------------------
knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)

## ----echo=FALSE---------------------------------------------------------------
suppressPackageStartupMessages(library("mmstat4"))

## ----eval=FALSE---------------------------------------------------------------
#  install.packages("mmstat4")

## ----eval=FALSE---------------------------------------------------------------
#  devtools::install_github("sigbertklinke/mmstat")

## ----eval=FALSE---------------------------------------------------------------
#  ghget('local')
#  ghopen("example_mcnemar.R")  # open a R example file

## ----eval=FALSE---------------------------------------------------------------
#  ghopen("example_mcnemar.py")  # open a Python example file

## ----eval=FALSE---------------------------------------------------------------
#  ghopen("pca_best_line/app.R")  # open a Shiny app

## ----eval=FALSE---------------------------------------------------------------
#  x <- ghload("TelefonDaten.csv")  # load a data set
#  head(x)

## ----echo=FALSE---------------------------------------------------------------
x <- ghget("local")
x <- ghload("TelefonDaten.csv")  # load a data set
head(x)

## ----eval=FALSE---------------------------------------------------------------
#  ghopen("Formelsammlung.pdf")  # open a PDF file

## ----eval=FALSE---------------------------------------------------------------
#  ghget(dummy="https://github.com/sigbertklinke/mmstat4.dummy/archive/refs/heads/main.zip")

## ----eval=FALSE---------------------------------------------------------------
#  ghget('dummy')
#  ghget('hu.stat')
#  ghget('hu.data')

## ----error=TRUE---------------------------------------------------------------
ghget(system.file("zip/mmstat4.dummy.zip", package = "mmstat4"))
ghget("https://github.com/sigbertklinke/mmstat4.dummy/archive/refs/heads/main.zip")
# tries https://github.com/my/github_repo/archive/refs/heads/[main|master].zip 
ghget("my/github_repo")  # will fail
#
ghget()                  # uses 'hu.data'

## -----------------------------------------------------------------------------
ghget('dummy')
gd <- ghdecompose(ghlist(full.names=TRUE))
head(gd)

## -----------------------------------------------------------------------------
ghlist("BANK2", full.names=TRUE) # full names
ghlist("BANK2")                  # short names

## ----eval=4-------------------------------------------------------------------
x <- ghload("data/BANK2.sav")          # load data via rio::import
ghopen("univariate/example_ecdf.R")    # open file in RStudio editor
ghsource("univariate/example_ecdf.R")  # execute file via source
ghlist("example_ecdf")                 # "univariate/" was unnecessary

## -----------------------------------------------------------------------------
str(ghlist())     # get all short names
ghlist("\\.pdf$") # get all short names of PDF files

## -----------------------------------------------------------------------------
ghlist("bnk")  # pattern = "bnk
ghquery("bnk") # nearest string matching to "bnk"

## -----------------------------------------------------------------------------
ghfile('data/BANK2.sav')
ghget(local=system.file("zip", "mmstat4.dummy.zip", package="mmstat4"))
fnf <- ghlist(full.names=TRUE)
dfn <- ghdecompose(fnf)
head(dfn)
head(ghpath(dfn))

## -----------------------------------------------------------------------------
ghget(local=system.file("zip", "mmstat4.dummy.zip", package="mmstat4"))
files <- ghlist(pattern="*.R$", full.names = TRUE)
cat(head(pkglist(files, repos="https://cloud.r-project.org"), 12))

## ----eval=FALSE---------------------------------------------------------------
#  cat(head(pkglist(files, repos=c("https://cloud.r-project.org", "http://R-Forge.R-project.org")), 12))

## ----eval=FALSE---------------------------------------------------------------
#  # just check the last files from the list
#  # Note that the R console will show more output (warnings etc.)
#  checkFile(files, start=435)  # alternatively: Rsolo

## -----------------------------------------------------------------------------
files <- ghlist(full.names = TRUE)
head(dupFiles(files))  # alternatively: Rdups

## -----------------------------------------------------------------------------
ghget(local=system.file("zip", "mmstat4.dummy.zip", package="mmstat4"))
ghnames <- ghdecompose(ghlist(full.names=TRUE))
ghnames[58,]

## ----error=TRUE---------------------------------------------------------------
x1 <- ghload("BANK2.sav")
x2 <- ghload("dbscan/BANK2.sav")
x3 <- ghload("cluster/dbscan/BANK2.sav")
x4 <- ghload("data/cluster/dbscan/BANK2.sav")
x5 <- ghload("examples/data/cluster/dbscan/BANK2.sav")

## ----eval=FALSE---------------------------------------------------------------
#  # install.packages("devtools")
#  devtools::install_github("sigbertklinke/mmstat4")

## ----eval=FALSE---------------------------------------------------------------
#  ghget("dummy", .force=TRUE)

## ----eval=FALSE---------------------------------------------------------------
#  ghget("dummy", .tempdir=FALSE)        # install non-temporarily
#  ghget("dummy", .tempdir="~/mmstat4")  # install non-temporarily to ~/mmstat4
#  ghget("dummy", .tempdir=TRUE)         # install again temporarily
#  

## ----eval=FALSE---------------------------------------------------------------
#  ghget("dummy", .tempdir=TRUE)
#  ghlist(pattern="/(app|server)\\.R$")
#  ghopen("dbscan") # open the app

## -----------------------------------------------------------------------------
ghget("dummy", .tempdir=TRUE)
ghlist(pattern="\\.csv$", ignore.case=TRUE, full.names=TRUE)
# use mmstat4::ghload for importing
ghlist(pattern="\\.csv$")
pechstein <- ghload("pechstein.csv")
str(pechstein)

## ----eval=FALSE---------------------------------------------------------------
#  sudo apt-get install python3 python3-dev python3-pip python3-venv libbz2-dev

## ----eval=FALSE---------------------------------------------------------------
#  reticulate::virtualenv_remove('mmstat4')
#  ghinstall('py', force=TRUE)

## ----echo=FALSE, message=FALSE, warnings=FALSE, results='asis'----------------
tabl <- "
| Repository       | Size          | ZIP file location |
| :--------------- | :-------------| :--------|
| `dummy`          | 3 MB          | `https://github.com/sigbertklinke/mmstat4.dummy/archive/refs/heads/main.zip`  |
| `hu.data`        | 29 MB         | `https://github.com/sigbertklinke/mmstat4.data/archive/refs/heads/main.zip`   |
| `hu.stat`        | 31 MB         | `https://github.com/sigbertklinke/mmstat4.stat/archive/refs/heads/main.zip`   |
"
cat(tabl) 

## ----eval=FALSE---------------------------------------------------------------
#  ghget("hu.stat")
#  ghopen("Statistik.pdf")
#  ghopen("Aufgaben.pdf")
#  ghopen("Loesungen.pdf")
#  ghopen("Formelsammlung.pdf")

## ----eval=FALSE---------------------------------------------------------------
#  ghget("hu.data")
#  ghopen("dataanalysis.pdf")

## ----eval=FALSE---------------------------------------------------------------
#  ghget("hu.data")
#  ghopen("cs1_roenz.pdf")

## ----eval=FALSE---------------------------------------------------------------
#  ghget("hu.data")
#  ghopen("cs2_roenz.pdf")

## ----eval=FALSE---------------------------------------------------------------
#  ghget("hu.data")
#  ghopen("glm_roenz.pdf")

Try the mmstat4 package in your browser

Any scripts or data that you put into this service are public.

mmstat4 documentation built on May 29, 2024, 11:15 a.m.