Skip to content

Instantly share code, notes, and snippets.

@ebdavison
Last active November 10, 2017 18:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ebdavison/e6e41744c1b7517809ac767d48751d7b to your computer and use it in GitHub Desktop.
Save ebdavison/e6e41744c1b7517809ac767d48751d7b to your computer and use it in GitHub Desktop.
> for (i in dtcols) {
+ print(i)
+ str(i)
+ newname <- gsub("^X", "", i)
+ print(newname)
+ str(newname)
+ }
[1] "X08.04.17"
chr "X08.04.17"
[1] "08.04.17"
chr "08.04.17"
[1] "X08.11.17"
chr "X08.11.17"
[1] "08.11.17"
chr "08.11.17"
[1] "X09.08.17"
chr "X09.08.17"
[1] "09.08.17"
chr "09.08.17"
[1] "X09.29.17"
chr "X09.29.17"
[1] "09.29.17"
chr "09.29.17"
>
> for (i in dtcols) {
+ newname <- gsub("^X", "", i)
+ df_out <- rename(df_out, i = newname)
+ }
Error: `newname` contains unknown variables
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment