BAT 402 - R Commands Simple Reviewer

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

1/41

flashcard set

Earn XP

Description and Tags

A review set of vocabulary flashcards covering basic R commands, functions, and operations from BAT 402.

Last updated 5:17 PM on 9/18/26
Name
Mastery
Learn
Test
Matching
Spaced
Call with Kai
Chat

No analytics yet

Send a link to your students to track their progress

42 Terms

1
New cards

str(df)

Shows the structure of the dataset, including column types and sample values.

2
New cards

head(df)

Shows the first 6 rows.

3
New cards

dim(df)

Shows the number of rows and columns.

4
New cards

summary(df)

Gives a quick statistical summary of the dataset.

5
New cards

mean(df$column_name)

Finds the average.

6
New cards

median(df$column_name)

Finds the middle value.

7
New cards

sum(df$column_name)

Adds all values together.

8
New cards

max(df$column_name)

Finds the largest value.

9
New cards

min(df$column_name)

Finds the smallest value.

10
New cards

table(df$column_name)

Counts how often each value/category appears.

11
New cards

is.na(df$column_name)

Checks which values are missing (NA).

12
New cards

colSums(is.na(df))

Counts missing values in each column.

13
New cards

colMeans(is.na(df))

Finds the proportion of missing values in each column.

14
New cards

round(…, 1)

Rounds a result to 1 decimal place.

15
New cards

df$column_name[is.na(df$column_name)] <- "value"

Fills missing values with a chosen value/category.

16
New cards

median(df$column_name, na.rm=TRUE)

Finds the median while ignoring missing values.

17
New cards

mean(df$column_name, na.rm=TRUE)

Finds the mean while ignoring missing values.

18
New cards

duplicated(df)

Checks which rows are duplicates.

19
New cards

sum(duplicated(df))

Counts the duplicate rows.

20
New cards

df[duplicated(df), ]

Displays the duplicate rows.

21
New cards

summary(df$column_name)

Check the minimum and maximum for unusual values.

22
New cards

boxplot(df$column_name, main = "…", ylab = "…")

Creates a boxplot to visualize the distribution and possible outliers.

23
New cards

main = "…"

Sets the graph title.

24
New cards

ylab = "…"

Sets the Y-axis label.

25
New cards

df$column_name[df$column_name == 12000] <- 12

Replaces an incorrect value.

26
New cards

df

Keeps only rows where the column is greater than 0.

27
New cards

Assignment operator. Stores a value/result.

28
New cards

==

Checks if two values are equal.

29
New cards

>

Checks if one value is greater than another.

30
New cards

as.Date(df$column_name)

Converts a column to Date type.

31
New cards

as.factor(df$column_name)

Converts a categorical column to factor.

32
New cards

as.character(df$column_name)

Converts a value/column to text.

33
New cards

as.integer(df$column_name)

Converts a value/column to integer.

34
New cards

as.integer(TRUE/FALSE)

Converts TRUE/FALSE to 1/0.

35
New cards

df$column_name <- df$column_name / df$column_name

Creates a new ratio from two columns.

36
New cards

df$column_name <- as.integer(condition)

Creates a 1/0 yes/no flag.

37
New cards

c("value1", "value2")

Combines values into a vector/list.

38
New cards

head(df[, c("column_name", "column_name")])

Shows the first rows of selected columns.

39
New cards

format(df$column_name, "%m")

Extracts the month number from a Date.

40
New cards

as.integer(format(df$column_name, "%m"))

Gets the month as an integer.

41
New cards

weekdays(df$column_name)

Gets the day of the week.

42
New cards

df$column_name %in% c("Saturday", "Sunday")

Checks whether a value is Saturday or Sunday.