[R] using mutate to remove all white space
Glenn Schultz
g|ennm@chu|tz @end|ng |rom me@com
Sun Mar 1 15:42:13 CET 2020
All,
This may not be the proper place to ask as the question is dplyr and removing white space using mutate. My code is below:
```{r, echo = FALSE, message = FALSE
conn <- myconnection
````
```{r, echo = FALSE, message=FALSE}
fhlloanbalance <- tbl(conn, "fhlloan_balance_view")
colnames(fhlloanbalance)
```
```{r, echo=FALSE, message=FALSE}
fhlloanbalance %>%
select(fctrdt, servicer) %>%
filter(fctrdt == '2020-01-01') %>%
mutate(servicer = 'I need to remove all white space')
```
I have tried a number of approaches using stringr - stringi - and gsub. The problem I think I am facing: I cannot seem to operate on the column in sql this is relative straight forward using replace. I have tried several approaches and scanned the internet but I cannot seem to come up with a workable solution. Any help is appreciated. I suppose I could just default back to sql but would prefer to use dplyr.
Best,
Glenn
More information about the R-help
mailing list