-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy path01-computer.Rmd
145 lines (93 loc) · 5.16 KB
/
01-computer.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
# Computing Tips {#computing}
Almost all of the students here use macs. It is not required, but it will make your life easier. These are some tips that I feel have made me successful, but there are definitely other ways to do it.
## Downloads
Here are some things you should get on your computer before you get started.
### Homebrew
Install homebrew. Homebrew is essentially a package manager. Paste the command below in your terminal prompt.
```
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
```
After doing that double check that you've got it installed correctly by running
```
brew doctor
```
If you see `Your system is ready to brew` you are good to go. You install packages by running `brew install package-name`, for example `brew install git` to install git (which you should do RIGHT NOW if you don't have it yet).
Some things I recommend getting now that you have brew installed:
* git
* python
* cowsay
* thefuck
### Bash-it
Make your terminal beautiful.
I really like Bash-it. Both because I like to say it outloud, and because it makes my terminal look baller. It has sweet plugins (like showing git branches!) and awesome aliases that will save your pretty little fingers.
To install, type this in terminal,
```
git clone https://github.com/revans/bash-it.git ~/.bash_it
```
then run,
```
~/.bash_it/install.sh
```
I use a slightly edited `bobby` theme. [Here](https://github.com/Bash-it/bash-it/wiki/Themes) are some other themes to choose from.
### R
If you don't already have it, download [`R`](https://cran.r-project.org) & if you'd like [RStudio](https://www.rstudio.com/products/rstudio/#Desktop)
## File Organization
File organization is super important. And fun! There are a lot of different conventions, I took a while iterating towards one I actually really like.
### Naming conventions
Since we have gone to so much effort to make our terminal look dope, we should be congizent of how to name folders to most easily use it (for example, folder and file names with spaces are a pain because you have to add quotation marks).
* Instead of spaces, uses - between words for folder & filenames
* name folders consistently within projects to allow you to reuse functions/run scripts (more below)
### Folders
I have 3 main folders:
* `phd `
* `working`
* `archive`
The `phd` folder is pretty self explanatory. Within this folder I have:
* `courses`
* `journal-club`
* `teaching`
The `working` folder contains projects I am actively working on. This includes RA work, projects I am working on with professors, consulting, and tutoring files. I have these separated because I am acutely aware of making sure these are backed up regularly on github. Within each of these, I have:
* `code`
* `data`
* `reports`
* `src`
The consistent naming convention allows me to have set code to run everything for each different project I am on. The `src` folder is especially useful for holding functions I have written that I reuse a bazillion times.
The `archive` folder contains projects that I have completed. These are backed up every time a new folder is added, but not as regularly as the `working` folder.
## Github {#github}
If you do not already have one, set up a [github account](https://github.com) -- make sure that you get an [education discount](https://education.github.com/) so you can set up private repos.
![](http://imgs.xkcd.com/comics/git.png)
* Jenny Bryan has an awesome course on [Github for the useR](http://happygitwithr.com/).
* [Gitkraken](https://www.gitkraken.com/) is a nice GUI to avoid using git at the command line
* For some [giggles](http://www.commitlogsfromlastnight.com)
## Bash Profile
Now that we've downloaded a bunch of nifty programs using `brew` and we have `github` up & running, you can save some typing time in terminal by adding aliases (shortcuts) to your `.bash_profile`.
1. Open Terminal and type `open -e ~/.bash_profile` (if you installed bash-it this will work, if you do not have a `.bash_profile` in your home directory yet, you can create one using your favorite text editor, for example `nano .bash_profile`)
2. Add some aliases like this:
`alias alias_name = "terminal command"`
For example:
```
# Edit profile
alias edit_profile="open -e ~/.bash_profile"
```
Here are some we $\heartsuit$:
```
# Set RStudio alias
alias RS="open -a RStudio"
# Set reload profile alias
alias reload_profile=". ~/.bash_profile"
# Edit profile
alias edit_profile="open -e ~/.bash_profile"
#Lazy git - will add, commit, and push with one command
# NOTE: each command (add, commit, push) in this function is progressively harder
# to undo/fix if you muck something up (e.g., adding PHI to a public repo!)
# so make sure you understand what you're doing
#Set our default branch to push to as the one we are in
git config --global push.default current
function lgit() {
git add -A
git commit -m "$1"
git push
}
```
## Statistical Software
In this department, we conduct the majority of our analyses using `R` & `python`. We use `Stata` for a few classes, so you may want to get that as well. If you are interested in learning SAS, check [this](https://support.sas.com/edu/schedules.html?ctry=us&id=2588) out.