V1 Flashcards

R as a calculator

1
Q

first computing/ algorithm

A
  • Charles Babbage: Analyical Engine
  • Ada Lovelace: First Algorithm
  • Alan M. Turing: Turing Machine
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

First Computer

A
  • built 1941, destroyed 1943
  • named Z3
  • built by Konrad Zuse
  • to calculate wing flutter
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

ENIAC

A
  • Electronic Numerical Integrator and Computer
  • electronic general-purpose computer
  • Turing-complete
  • digital
  • capable of being reprogrammed
  • loops, branches and subroutines
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

programming language

A
low level:
- punch cards
- assembly
mid level:
- C
high level: 
- LISP
- COBOL
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

R-Programming language

A
  • free and open source
  • statistical computing
  • graphics
  • written in : R, Fortran, C
  • operating system agnostic
  • linear and non.linear models
  • built-in testing and help
  • many add-on packages available (4000+)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

exponents (coding)

A
  • 5^2 or 5**2
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

what is euclidean division + coding

A
  • how often one number fits into the other (39/100, 2 is the euclidean divisor)
  • %/%
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

what is euclidean division remainder + coding

A
  • how often one number fits into the other - what remains after (39/100, 2 is the euclidean divisor, 39*2-> 78 -> 22 left over

%%

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

special numerical constant (coding)

A

infinite - inf
NaN - not a number
NA - missing

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Built in character constants (coding)

A
  • LETTERS: 26 upper case letters
  • letters_ 26 lower case letters
  • month.abb: 12 months 3-letter abbreviations
  • month.name: 12 months
  • pi: ratio of the circumference of a circle to its diameter
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

imaginary numbers (coding)

A

as 0i -> instead of sqrt(-1) do sqrt(-1+0i)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

basic trigonometry functions (coding)

A
  • sin, cos, tan, asin, etc
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

logarithms (coding)

A

log(5) - natural log of 5
log10(5) - base 10 log of 5
exp(1) - e^1

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

How to manage your Session - Work directive (4)

A
  • getwd(): where does R save/retrieve files
  • dir(): what files are there
  • setwd(): set another place to save/retrieve files
  • Is(): what is in the current environment
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

How to handle package and save things + end R

A
  • install.packages(“qtl”) - install package
  • library(qtl) - load a package
  • save(object, file = “Your.RData”) - save object as binary
  • save.image(“Your-RData”) - save the whole environment
  • q(“no”) - quit the r session
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

how to use help with functions and terms

A
  • ?functionname - open the help file for function

- ??term search for a term across

17
Q

types of data (5)

A
  • logical : TRUE, FALSE
  • Numeric: 5, 6, 78 …
  • Character: “one”, “two” …
  • Vector - c (1, 4, 6, 7) - can be numerical, logical or character
    Matrix - Y
18
Q

useful function to deal with data types

A
  • length(): number of elements
  • str(): structure of an object
  • class(): class or type of an object
  • names(): names
  • as.: force to a certain type
  • is.: is of a certain type
19
Q

Creating a vector

A
  • c(object, object, …): combine objects into a vector
  • seq(from, to, by): a numerical sequence
  • rep(object, repeat times): repeat an object / number
20
Q

Creating a Matrix

A
  • matrix(vector, nrow, ncol): create a matrix from a vector
  • cbind(object, object…): combine objects as columns
  • rbind(object, object…): combine objects as rows
21
Q

Indexing a Vector

A

“A” “B” “C” “D” “E” “F” “G” “H” “I”
V[5] -> “A” “B” “C” “D” “E” “F” “G” “H” “I”
V[2:5] -> “A” “B” “C” “D” “E” “F” “G” “H” “I”
V[c(2:5,8)] -> “A” “B” “C” “D” “E” “F” “G” “H” “I”

22
Q

Indexing a Matrix

A

m[1:3, 1] - row 1:3 , column 1 (three)
m[5, 3:6] - row 5, column 3:6 (three)
m[8, 7] - row 9, column 7 (one)
m[, 9] - all of column 9

23
Q

advances types

A
  • data frame: not a matrix, can contain multiple basic types
  • list - not a vector, can contain anything
  • factor
  • comments (#)
24
Q

Matrix and data frame functions (5)

A
nrow() : number of rows
ncol(): number of columns
rownames(): row names
colnames(): columns names
t(): transpose
25
Q

Important about clean code

A
  • use new directory for new lecture
  • name files in a logical way
  • add a header to each file (comment section): Name, date, purpose of file and copy right
  • use a lot of comments and indent where needed