String Manipulation(2/9): Why does it need a 'sep' here?

Screen Link: https://app.dataquest.io/c/61/m/324/string-manipulation/7/class-size-data-creating-a-key-using-string-manipulation

My Code:

class_size <- class_size %>%
    mutate(DNB = str_c(CSD, `SCHOOL CODE`)) %>%
    mutate(DNB = str_pad(DNB, width = 6, side = 'left', pad = '0'))

What the answer says:

class_size <- class_size %>%
  mutate(DBN = str_c(CSD, `SCHOOL CODE`, sep = "")) %>%
  mutate(DBN = str_pad(DBN, width = 6, side = 'left', pad = "0"))

What I don’t understand is why does the str_c part of the answer need a separator?

Turns out I got the “DNB” part of my own code wrong. Sorry if this caused any inconvenience to anyone!

1 Like