Ok, I selected string variables only using my original source file and:
library(dplyr)
source <- select_if(original.file, is.character)
and thirst records are following:
source <- data.frame(
stringsAsFactors = FALSE,
Country_Name = c("United Kingdom","United Kingdom","United Kingdom",
"United Kingdom"),
OrgCode = c("00007P", "GBC500", "GBC210", "01519Q"),
VIN = c("VF12S8763",
"W0VM1000","WVZ604259","VF3CW0497"),
Model = c("dfdfsdf", "sdv", "sdv", "sdsasd"),
FamilyName = c("abd", "fsf", "sfd", "sd"),
CommercialName = c(NA, "E2JO", NA, NA),
EngineType = c("Other", "Other", "Other", "Other"),
ModelName = c("aaa", "bbb", "ccc", "ddd"),
URN = c("21G9234901025","21G9100813605","21GB021349733",
"21GB012802731"),
QN3a = c(NA,NA,
"Your sales representative, was most helpful",
"No pressure from Salesmen. Safe environment."),
QN5a = c(NA, NA, "Nothing to dislike.", "None"),
QN5b = c(NA,
"When I went to pick up my new car it had a dent on the rear panel",NA,NA),
QN3b = c(NA,
"Not much really what should have been a good experience for me",NA,NA),
QF3 = c(NA,
"They were friendly enough but the problems overshadowed everything",NA,NA),
QF5 = c(NA,
"Again the damage in the car overshadowed anything that was said by the staff",NA,NA),
QF11_1 = c(NA, "Damaged from my first view", NA, NA),
QF13 = c(NA,
"They missed the damage in both occasions",NA,NA),
QG2 = c(NA, "Only a brief overview was given.", NA, NA),
OrgName = c("aaa", "bbb", "ccc", "ddd"),
ParentBranch_Description = c("104", "5", "4", "102"),
Parent_Branch_Description = c("SALES REGION : NORTH","2","1","SALES REGION 1: NORT",
NA)
)
renamed <- rename_with(source,
.fn=~paste0("Comm",.),
.cols=where(~is.character(.x) &&
any(nchar(.x) > 10)))
unfortunately, this error appears after remaning:
Error: `where()` must be used with functions that return `TRUE` or `FALSE`.
Run `rlang::last_error()` to see where the error occurred.
What am I doing wrong?