Title: Theory / Unimportant / CS / Programming / R / Hands-on Grolemund - Wickham
Tags: récupéré seen_description automatedNewLineAfterCommaSpace computer_to_instruction hasNotNewEffectReturnsMeaning comment fromCommandLine FromInstruction empty_card_names
On every note of this deck, unless a note says otherwise:
Language: RStudio
Chapter: 1

Definition: The i-th output is foo
Page: 4
Chapter: 1
Context: RStudio
Notation: [i] foo

Instruction: i:j
Page: 4
Effect: The list of numbers from i to j included

Question: Is R compiled or dynamic
Answer: Dynamic
Page: 5
Chapter: 1
Context: RStudio

Definition: Previous line was not an entire command. Rstudio waits for the remaining
Page: 5
Chapter: 1
Context: RStudio
Representation: + starting a line

Language: RStudio
Instruction: #
Other fields (not shown on cards):
Chapter: 1
Page: 5

Instruction: ##
Page: 6
Effect: Starts a comment which is the result of the previous code

Page: 6
Effect: Halts the current computation
Abbreviation: Ctrl+C

Name: An object
Definition: Something in which data can be stored
Page: 7
Chapter: 1
Context: RStudio

Instruction: foo <- bar
Page: 7
Effect: Compute bar, saves its value in foo

Instruction: foo
Page: 7
Variables: foo an object
Name: the value saved in foo

Name: Environment pane
Definition: The upper-right part of RStudio, where objects are shown
Page: 7
Chapter: 1
Context: RStudio

Instruction: ls()
Page: 9
Effect: List the object name currently used

Question: Is R case-sensitive ?
Answer: Yes ?
Page: 9
Chapter: 1
Context: RStudio

Instruction: foo/bar
Page: 9
Returns: The result of the division of foo by bar
Typ: float

Instruction: op(foo)
Page: 10
Effect: Apply op to each element of the vector
Variables: foo a vector
op an operation

Instruction: op(
  foo_1,
  foo_2
)
Page: 10
Effect: Show a warning if the length of one does not divide the length of the other one
Variables: foo_1, foo_2 a vector
op an operation
Name: The vector of length n whose i th element is op(e_1, e_2), where e_j is the (i mod n_j)-th element of vector j.
With n the length of the greatest vector. n_j the length of the j-th vector.

Instruction: foo_1 %*% foo_2
Page: 11
Variables: foo_1, foo_2 a vector
Name: The inner multiplication of the foo_i

Instruction: foo_1 %o% foo_2
Page: 11
Returns: The outer multiplication of the foo_i
Variables: foo_1, foo_2 a vector

Instruction: t foo
Page: 12
Returns: The transpose the matrix foo

Instruction: det foo
Page: 12
Name: The determinant of the matrix foo

Instruction: round(
  foo,
  digits=bar
)
Page: 14
Returns: The float with bar digits closest to foo.

Instruction: round(foo)
Page: 12
Returns: The integer closest to foo

Instruction: factorial(foo)
Page: 12
Returns: foo!

Name: A function argument
Definition: Data passed to a called function
Page: 12
Chapter: 1
Context: RStudio

Instruction: mean(foo)
Page: 12
Name: the mean of the elements of the vector foo

Instruction: sample(
  x=foo,
  size = bar,
  replace=TRUE
)
Page: 14
Name: bar random element of the vector foo

Instruction: sample(
  x=foo,
  size = bar
)
Page: 12
Name: bar random distinct element of the vector foo

Instruction: args(foo)
Page: 14
Name: A description of the function foo

Instruction: foo(
  buz_1,...,
  buz_m,bar_1=plop_1,
  ..., bar_n=plop_n
)
Page: 14
Effect: Call function foo with buz_i as the m first parameters, and plop_i for parameter bar_i

Name: A function
Definition: a name
Page: 17
Chapter: 1
Context: RStudio
Definition2: a body of code
Conjdef: A tuple
Definition3: a set of arguments

Instruction: foo (
  bar_1=[plop_1] ,
  ..., bar_n=[plop_n]
){
  plop_1
_  ...
_  plop_n
}
Page: 17
Name: A function,
  taking arguments bar_i. Arguments are facultative if plop_i is given.
When it is called it execute each plop_i. It returns plop_n

Instruction: sqrt(foo)
Page: 18
Effect: The square root of foo

Name: Body of a function
Definition: The part of the function stating what to execute when the function is called
Page: 20
Chapter: 1
Context: RStudio

Name: Default values
Definition: values used for arguments of a function when no other values are given when calling this function
Page: 20
Chapter: 1
Context: RStudio

Name: A script
Definition: A plain text file with code in it.
Page: 20
Chapter: 1
Context: RStudio

Instruction: Code>Extract function
Page: 20
Effect: Create a function from the selected code