Unable to cover to cases of strings

In my data set I simply want to convert the value of "AAA" to "Aaa", I try to do the str_to_title() function but get an error message. I also tried using gsub(), and again I get an error message. I'm working a dataset that was imported from a CSV file.

Can you be more specific? What error message are you getting?
As you can see this works

library(stringr)

str_to_title("AAA") 
#> [1] "Aaa"

Created on 2020-11-09 by the reprex package (v0.3.0.9001)
Can you provide a proper REPRoducible EXample (reprex) illustrating your issue?

library(tidyverse)

(MAPCMoody <- dplyr::band_instruments)

(MAPCMoody2 <- MAPCMoody %>% 
               mutate_if(is.character,
                          str_to_title))

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.

That warning message is telling you that the input is in wrong format and since we can't possibly know what that format is, we need a reproducible example in order to help you, please read the guide on the link I gave you before and try to make a proper reproducible example.

This is the error message I'm getting

Warning message:
In stri_trans_totitle(string, opts_brkiter = stri_opts_brkiter(locale = locale)) :
  argument is not an atomic vector; coercing

That line of code only shows that you are using incorrect syntax but since you are not providing sample data in a copy/paste friendly format I can't try to fix it for you, as I said before, please read the guide and try to provide a proper reproducible example, otherwise there is not much I can do for you. Good luck!

Here's the code I wrote:

MAPCMoody2 <- MAPCMoody %>% str_to_title("AAA")
*1*    *2*   *3*     *4*
Aa      Aaa   A      Aaa
A       Baa   Aa     AAA
AAA     AAA   AA     Baa 
A       AA    Baa    AAA

I want to turn all the "AAA" to Aaa