EZ Study

Actuarial Biology Chemistry Economics Calculators Confucius Engineer
Physics
C.S.

Unix Shell R Code Practice Workshop

Resources:
Workshop website: https://moorepants.github.io/2015-02-21-uci/
https://github.com/zonca/swcarpentry-workshop-pandas/blob/master/cheatsheet.md

Online Notes
Shell: http://software-carpentry.org/v5/novice/shell/index.html
http://swcarpentry.github.io/v4/matrix/index.html Python: http://swcarpentry.github.io/python-novice-inflammation/
Pandas: http://nbviewer.ipython.org/github/zonca/swcarpentry-workshop-pandas/blob/master/pandas.ipynb
Version Control: http://swcarpentry.github.io/git-novice/

###############################tutorial for unix shell:
http://software-carpentry.org/v5/novice/shell/index.html
Need to download and install the Bit Bash Tool first:
Install Git for Windows by download and running the installer. This will provide you with both Git and Bash in the Git Bash program.

Software Carpentry Installer

This installer requires an active internet connection.
After installing Python and Git Bash: Download the installer.
If the file opens directly in the browser select File→Save Page As to download it to your computer.
1) Open from the Bit bash terminal:
 
cd
hit

git clone https://github.com/moorepants/swc-lessons-sample-data.git swc 

whoami

pwd

ls
ls -F

cd swc
ls -F
 
cd filesystem

ls -F
ls -F users

cd  users/nelle
cd ..  going back parent directory

ls -F -a
ls
ls -F north-pacific-gyre
ls -F north-pacific-gyre/2012-07-03

pwd

cd go to the home directory
use tab for the auto complete
ls -F to list the directory

mkdir thesis:  make directory
cd thesis

pwd
nano draft.txt:  create a draft.txt file by nano

rm draft.txt:  to remove the file 
$ rmdir thesis: to remove the directory
$ rm -r thesis: to remove the directory

$ mv thesis/draft.txt thesis/quotes.txt

$ cp quotes.txt thesis/quotations.txt
$ ls quotes.txt thesis/quotations.txt

cd -: go back to the previous directory

$ cd molecules
$ wc *.pdb  lines/words/characters

$ wc -l *.pdb count lines
$ wc -c *.pdb count letters/characters
$ wc -l *.pdb > lengths  save num of lines into lengths

cat lengths : to show the file
$ sort -n lengths
$ sort -n -r lengths : sort in the desending order

$ cut -d , -f 2 animals.txt  : to choose the 2nd by using dlimiter 

Control C to exit the current computing

$ echo hello there: to print out
Related links:
Continue to Unix Shell R Code Practice Workshop --II   SAS Interview

Back to R Coding Tutorial: Using R in Python   Analytics Home