Install package
https://community.linuxmint.com/tutorial/view/1525
sudo apt-get install pacName
sudo apt-get update
sudo apt-get upgrade
https://askubuntu.com/questions/94102/what-is-the-difference-between-apt-get-
update-and-upgrade
check if package installed
dpkg -s libssl-dev pName
download torrent
http://www.itzgeek.com/how-tos/linux/linux-mint-how-tos/install-utorrent-on-linux-mint-18.html
utserver -settingspath /opt/utorrent-server-alpha-v3_3
chek if devtools are installed
library(devtools)
has_devel()
install package from bitbucket:
devtools::install_bitbucket()
reload R package:
Ctrl/Cmd + Shift + L
tidy up R code:
install.packages("formatR")
formatR::tidy_dir("R")
Loading vs Attaching
Load : load all data n fcns to memory (:: when has not loaded
previously)
Attach: After loading, attach the package in search path (library/
require)
Import vs Depend
Listing a package in either Depends or Imports ensures that it’s
installed when needed. The main difference is that where Imports
just loads the package, Depends attaches it. There are no other
differences. The rest of the advice in this chapter applies
whether or not the package is in Depends or Imports.
Unless there is a good reason otherwise, you should always list packages in Imports not
Depends. That’s because a good package is self-contained, and minimises changes to the global
environment (including the search path). The only exception is if your package is designed to be
used in conjunction with another package. For example, the analogue package builds on top of
vegan. It’s not useful without vegan, so it has vegan in Depends instead of Imports. Similarly,
ggplot2 should really Depend on scales, rather than Importing it.
Submission to CRAN
You must fix all ERRORs and WARNINGs. A package that contains any
errors or warnings will not be accepted by CRAN.
• Eliminate as many NOTEs as possible. Each NOTE requires human oversight, which is a
precious commodity. If there are notes that you do not believe are important, it is almost
always easier to fix them (even if the fix is a bit of a hack) than to persuade CRAN that
they’re OK. See check descriptions for details on how to fix individual problems.
If you have no NOTEs it is less likely that your package will be flagged for additional human
checks. These are time consuming for both you and CRAN, so are best avoided if possible.
• If you can’t eliminate a NOTE, document it in cran-comments.md, describing why you
think it is spurious. Your comments should be easy to scan, and easy to match up with R
CMD check. Provide the CRAN maintainers with everything they need in one place, even
if it means repeating yourself.
Issue:
floor(7)
License: GPL-3 ??
look at issues problem on text (checking sec)
Resource on R list
http://www.r-tutor.com/r-introduction/list
http://www.r-tutor.com/r-introduction/list/named-list-members
R_objects
https://www.programiz.com/r-programming/object-class-introduction
http://adv-r.had.co.nz/OO-essentials.html
S3 do not usually have a formal definition of class (the methods
are known as generics, in this case), but you can define it
formally.
Magic ...
myFunction <- function(l, ...){
value <- lapply(l, function(x){
log(x, ...)
})
return(value)
}
Then you can run it (for example)
myFunction(l = myl, base = exp(100))
R can have multiple classes (stored as vector)
> bubba <- c(1,2,3)
> bubba
[1] 1 2 3
>
> class(bubba)
[1] "numeric"
>
> class(bubba) <- append(class(bubba),"Flamboyancy")
> class(bubba)
[1] "numeric" "Flamboyancy"
Issues solved
added @return of lgt functions,
package documentation fixeds,
created constructor for “lgt” S3 class,
replaced Stan # comments,
added license,
added some descriptions (need to be filled and review later),
Material for Rhat:
https://blog.stata.com/2016/05/26/gelman-rubin-convergence-
diagnostic-using-multiple-chains/
Suppose we have M chains, each of length N, although the chains
may be of different lengths. The same-length assumption simplifies
the formulas and is used for convenience. For a model parameter θ,
let {θmt}Nt=1 be the mth simulated chain, m=1,…,M. Let θ^m and
σ^2m be the sample posterior mean and variance of the mth chain,
and let the overall sample posterior mean be θ^=(1/M)∑Mm=1θ^m. The
between-chains and within-chain variances are given by
BW=NM−1∑m=1M(θ^m–θ^)2=1M∑m=1Mσ^2m
Under certain stationarity conditions, the pooled variance
Vˆ=N−1NW+M+1MNB
is an unbiased estimator of the marginal posterior variance of θ (Gelman and Rubin 1992). The
potential scale reduction factor (PSRF) is defined to be the ratio of Vˆ and W. If the M chains have
converged to the target posterior distribution, then PSRF should be close to 1. Brooks and Gelman
(1997) corrected the original PSRF by accounting for sampling variability as follows:
Rc=d^+3d^+1VˆW−−−−−−−−⎷
where d^ is the degrees of freedom estimate of a t distribution.
Managing VNC connection
ssh ubuntu@43.240.96.210
@INSTANCE
vncserver -geometry 1024x768 -depth 24
ps aux | grep ssh
@LOCAL
kill first
ssh -L 5900:localhost:5901 -N -f -l ubuntu 43.240.96.210
you want to use readRDS/saveRDS:
https://www.fromthebottomofthe
Run the script:
R CMD INSTALL Rlgt_0.0-1.tar.gz
nohup Rscript M3sdampen.R &
nohup Rscript lala_testing.R &
output gets written to nohup.out. See the file:
tail -f nohup.out