Coding Commands

0.0(0)
Studied by 0 people
call kaiCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/52

encourage image

There's no tags or description

Looks like no tags are added yet.

53 Terms

1
New cards

!

Equivalent to not

2
New cards

[]

Selects specific items in the dataset

3
New cards

Where is rows and columns in []

[row, column]

4
New cards

exclude = NULL

Separates NA into their own category

5
New cards

dim()

Shows the number rows then columns

6
New cards

nrow()

Tells you the number of rows

7
New cards

data.frame()

Puts variables into a data set

8
New cards

select()

Picks columns

9
New cards

filter()

Picks rows

10
New cards

level()

Shows the categories for vairables labelled factors

11
New cards

table()

Counts the number of observations for each unique category

12
New cards

colSums()

Sums up the values in each column

13
New cards

ggplot(penguins, aes(x=flipper, y=body)) +

geom_point(color = “blue”, alpha = 0.6))

Makes every point blue

14
New cards

ggplot(penguins, aes(x=flipper, y=body))+

geom_point(aes(color = “blue”))

Creates a legend with the word blue

15
New cards

If alpha is placed inside aes()

Legend is made, and chracteristics not applied because it assumes it’s a variable

16
New cards

If alpha or colour is placed outside aes()

No legend is made, and characteristics applied

17
New cards

facet_wrap(~variable)

Adds multiple separate graphs with the same axis

<p>Adds multiple separate graphs with the same axis</p>
18
New cards

face_grid(variable~variable)

Creates a grid of graphs between two variables

19
New cards

cor(x,y)

Finds pearson’s correlation

20
New cards

lm(y~x)

Predicts linear mnodel

21
New cards

sample()

Randomly picks numbers`

22
New cards

function()

Named chunk of code that can be ran

23
New cards

quantile(c(lower, upper))

Finds intervals

24
New cards

pnorm()

Gives area under the standard normal curve below z (you put in a z score)

25
New cards

qnorm()

Gives z scores from an area from the left side

26
New cards

position

the bars dodge each other and allows visualization of the raw sample size

27
New cards

%

Feeds study one through another function

28
New cards

paired = TRUE

Columsn are matched

29
New cards

var.equal = TRUE

Variance are equal, useful for student’s pooled-variance t-test

30
New cards

as_tibble()

Adds features and cleans up presentation when you call it

31
New cards

labs()

Renames the axis, legend titles

32
New cards

fill = variable_name

Filsl in data based on the different variables

33
New cards

!is.na()

Excludes NA values

34
New cards

use = “complete.obs”

Ignore rows with NAs

35
New cards

se = FALSE

Doesn’t show the standard error

36
New cards

se = TRUE

Shows the standard error

37
New cards

coef()

Pulls out intercept and slope

38
New cards

sample(#:#, size = #)

Randomly picks # values from #:#

39
New cards

replace = TRUE

Replaces values

40
New cards

2*pnorm(-abs(z))

Calculates two tailed p value

41
New cards

pnorm(1.96, lower.tail = FALSE)

Gives area above 1.96

42
New cards

round()

Prints a rounded output

43
New cards

qt()

Finds tcritical value based on the value and df

44
New cards

pt()

Finds the p value for the given value

45
New cards

na_if(x,value)

Replaces x with NA

46
New cards

bp_post = na_if(bp_post, -999)

Within bp_post, replace -999 into NA

47
New cards

mutate()

Creates new columns, edits, or delete column in a dataframe

48
New cards

mutate(change = bp_post - bp_pre)

Makes a new difference score column

49
New cards

t-test(y,x)

Performs a Student’s or Welch’s two sample t-test

50
New cards

aov( y ~ group, data = dataframe)

Performs a one-way ANOVA

51
New cards

qf(alpha, df1 = group, df2 = error)

Calculate the critical F at set alpha value

52
New cards

filter(!is.na(bp_pre)

Filters out NA

53
New cards

Pr(>F)

Probability of F value being greater or equal to