Need Help Coding PLEASE

library(lubridate)
correct_con %>%

  • rename("startdate" -- "start_date / Injury Date")

Hello, I am getting an error code: for this:

Error in rename():
:information_source: In argument: "startdate" - -"start_date / Injury Date".
Caused by error in -"start_date / Injury Date":

What am I doing wrong? :frowning:

We have no idea.
We need some idea of what your data looks like and what you are doing.

At best, we probably need to see what data you are using>

A handy way to supply sample data is to use the dput() function. See ?dput. If you have a very large data set then something like head(dput(myfile), 100) will likely supply enough data for us to work with. Just copy and paste the dput() output here between

```

```

Hi @jellylearningcoding , try to put a dput like said @jrkrideau

If your df is correct_con, try this

# Before check the correct column names of df
names(correct_con )
correct_con %>% rename(startdate = `start_date / Injury Date`)  # remember use `` if a column have a spaces.

I'm just guessing, but if you has a dataframe with a variable called "startdate" that you wanted to rename to "start_date / Injury Date", this is how could do that:

library(lubridate)
library(dplyr)

correct_con <- data.frame(
  "startdate" = c("2024-10-01", "2024-10-02", "2024-10-03"),
  "end_date"   = c("2024-10-08", "2024-10-08", "2024-10-10")
)

correct_con %>%
  rename("start_date / Injury Date" = "startdate")