Lezione 1 Flashcards

1
Q

6 main rules

A

rm(list=ls())

Use # to comment

Set directory properly and check which files are available with function dir()

Before reading csv files check if data are separated by commas

Use str() function

use dots for decimal numbers instead of commas

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

How do I create new objects?

A

An = sign is always necessary to create new objects

I can print them on the console by just typing them in the script

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

setwd() and get()

A

Set and print the active folder on the console.

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

read.csv

A

Comma Separated Values

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

head(data)

A

Print on the console the first rows and columns of a dataframe

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

Environment

A

Left Side Toggle: see dataframe structure (str())

Right Side Tab: open new script with full table of data

Delete an object: grid mode=> broom emoji

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

Delete dataframe vector

A

dati_pinguini$X = NULL

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

Convert Vector from chr to num

A

dati$X = factor(dati$X)

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

Create vectors (2 ways)

A

v1=c(1,2,3,4)
v3 = seq(1,10, by = 0.1)

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

Second v1 element

Second and fourth v1 element

From the first to the third v1 element

A

v1[2]
v1[c(2,4)]
v1[1:3]

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

Calculate Quantile

A

quantile(dati$peso, c(0.25, 0.75))

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

Dispersion Indices

A

var(dati$peso)
sd(dati$peso)
IQR(dati$peso)

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

summary(data)

A

Prints out the main position indices on the console

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