Thursday 11 July 2013

R: basics - installastion, environment and debug

Install R

  • $sudo apt-get install r-base

R edit environment

R basics

  • Install extra package
    • > install.packages("ismev")
  • Source R script
    • > source("fit-gumbel.r")
  • Call function provided by fit-gumbel.r
    • > fit-gumbel("in.dat")

R debug

take optim function as an example

  • display source code of optim
    • > edit(optim)
  • set debug mode
    • > debug(optim)
  • check debug mode
    • > isdebugged(optim)
  • cancel debug mode
    • > undebug(optim)
  • debug optim (R source code src/library/stats/R/optim.R)
    • > debug(optim)
    • > out <- gumbel(dat)
    • Browser[2]> where
    • Browser[2]> [RET] - next step
    • Browser[2]> c - continue
    • Browser[2]> n
    • Browser[2]> Q
    • Browser[2]>

tmux usage

  • tmux quick set
    • tmux to take out the tmux terminal environment
    • C-b % to split window into two panes (vertically)
    • C-b :split-window to split window into two panes (horizontally)
    • C-b o switch to next pane
    • C-b x kill current pane
  • C-b has change to C-a
    • download a tmux.conf file
    • tmux source-file /devt/dev-rye/tmux-conf/tmux.conf
    • C-a | split vertically
    • C-a - split horizontally

No comments :

Post a Comment