Thursday, February 21, 2019

Creating a weekly ts time series object in R


https://stackoverflow.com/questions/22188660/r-time-series-modeling-on-weekly-data-using-ts-object

for a use :

library(lubridate)
data = 1:319
ts(data, freq=365.25/7, start=decimal_date(ymd("2013-1-13")))

Thursday, June 29, 2017

Ubuntu cannot get the login page under some wifi captive portals

The following made the fix :
sudo dpkg-reconfigure resolvconf

Tuesday, March 1, 2016

Install from R command line a package source on disk


install.packages("c:/Users/utsav/Source/Repos/crosstalk/", repos = NULL, type="source")

Monday, February 29, 2016

Rstudio does not see rJava under Ubuntu 12.04

library(rJava) in Rstudio gives the error :
Error : .onLoad failed in loadNamespace() for 'rJava', details:
  call: dyn.load(file, DLLpath = DLLpath, ...)
  error: unable to load shared object '/home/anh/Rlibs/rJava/libs/rJava.so':
  libjvm.so: cannot open shared object file: No such file or directory 

Solution : add
export LD_LIBRARY_PATH=/usr/lib/jvm/java-8-oracle/lib/amd64:/usr/lib/jvm/java-8-oracle/jre/lib/amd64/server

into /etc/bash.bashrc , then run

. /etc/bash.bashrc

then run

sudo R CMD javareconf

then restart Rstudio

Tuesday, November 3, 2015

Git credential store

If your online git server does not allow ssh (like Microsoft Visual Studio Online), you can store git credentials in a file (not safe)

git config credential.helper store
see https://git-scm.com/docs/git-credential-store

Tuesday, September 29, 2015

plot multiple columns on the same graph in R with reshape2 and ggplot2

http://stackoverflow.com/questions/9531904/plot-multiple-columns-on-the-same-graph-in-r


s <- span=""> 
"A       B        C       G       Xax
0.451   0.333   0.034   0.173   0.22        
0.491   0.270   0.033   0.207   0.34    
0.389   0.249   0.084   0.271   0.54    
0.425   0.819   0.077   0.281   0.34
0.457   0.429   0.053   0.386   0.53    
0.436   0.524   0.049   0.249   0.12    
0.423   0.270   0.093   0.279   0.61    
0.463   0.315   0.019   0.204   0.23
"
d <- span=""> read.delim(textConnection(s), sep="")

library(ggplot2)
library(reshape2)
d <- span=""> melt(d, id.vars="Xax")

# Everything on the same plot
ggplot(d, aes(Xax,value, col=variable)) + 
  geom_point() + 
  stat_smooth() 

Wednesday, September 23, 2015

Removing services from system boot

sudo update-rc.d -f postgresql remove
sudo update-rc.d -f mysql remove

or

In the Upstart system:
create a file called sudo vi /etc/init/nginx.override
and put the word "manual" in it.


sudo systemctl disable apache2  (Does not work for 14.04. It's for newer Ubuntu releases)