How to change values in character variable in R?How to sort a dataframe by multiple column(s)How to Correctly Use Lists in R?How to make a great R reproducible exampleR colnames: A few character variable name changed to numberR: How to get parent attributes and node values at the site time?data.table vs dplyr: can one do something well the other can't or does poorly?Generate dummy variable with multiple levels in RUsing lapply to recode variables and paste an index numberhow to change default ordering of factor variable by the alpha sorting of their level namesError “contrasts can be applied only to factors with 2 or more levels” for variables with 2 levels and values on both levels

What are one's options when facing religious discrimination at the airport?

Lost passport and visa, tried to reapply, got rejected twice. What are my next steps?

Would a horse be sufficient buffer to prevent injury when falling from a great height?

Why does `FindFit` fail so badly in this simple case?

Would a 737 pilot use flaps in nose dive?

Why does it seem the best way to make a living is to invest in real estate?

Can adverbs modify adjectives?

Can you cure a Gorgon's Petrifying Breath before it finishes turning a target to stone?

Detail vs. filler

Why has Speaker Pelosi been so hesitant to impeach President Trump?

Which Catholic priests were given diplomatic missions?

Calculate the Ultraradical

Why is STARTTLS used when it can be downgraded very easily?

Garage door sticks on a bolt

How does Monks' Improved Unarmored Movement work out of combat?

Verb ending in -ん with positive meaning?

Is it possible for a company to grow but its stock price stays the same or decrease?

How important is knowledge of trig identities for use in Calculus

Why would an airline put 15 passengers at once on standby?

How do I automatically add linebreaks "\" to the end of each row of a tabular environment?

How to add the real hostname in the beginning of Linux cli command

Why isn't there armor to protect from spells in the Potterverse?

Phonetic distortion when words are borrowed among languages

GPLv3 forces us to make code available, but to who?



How to change values in character variable in R?


How to sort a dataframe by multiple column(s)How to Correctly Use Lists in R?How to make a great R reproducible exampleR colnames: A few character variable name changed to numberR: How to get parent attributes and node values at the site time?data.table vs dplyr: can one do something well the other can't or does poorly?Generate dummy variable with multiple levels in RUsing lapply to recode variables and paste an index numberhow to change default ordering of factor variable by the alpha sorting of their level namesError “contrasts can be applied only to factors with 2 or more levels” for variables with 2 levels and values on both levels






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








0















Goal:
I want to recode the values of a character variable. I need to simplify values which repeat all the time with differents ways, but I can't.



Problem:
When I change this values, codes overlap.



My Data:



> datos[c(1:30),"categorias"]
[1] 0FICIAL 1ª (OF. VARIOS) ABOGADOS/AS ABOGADOS/AS
[4] ADMINISTRATIVO ADMINISTRATIVO ADMINISTRATIVO
[7] ADMINISTRATIVO ADMINISTRATIVO OFICIAL DE PRIMERA Administrativo. Personal
[10] Administrativo. Personal Administrativo/a Albañil
[13] Albañil Oficial 1ª Albañil Oficial 1ª ANIMADOR COMUNITARIO
[16] ANIMADOR SOCIOCULTURAL ANIMADOR SOCIOCULTURAL ANIMADOR SOCIOCULTURAL
[19] ANIMADOR SOCIOCULTURAL ANIMADOR SOCIOCULTURAL ANIMADOR SOCIOCULTURAL
[22] ANIMADOR SOCIOCULTURAL ANIMADOR SOCIOCULTURAL ANIMADOR SOCIOCULTURAL
[25] ANIMADOR SOCIOCULTURAL animador turistico ANIMADOR/A
[28] ANIMADOR/A SOCIOCULTURAL ANIMADOR/A SOCIOCULTURAL ANIMADOR/A SOCIOCULTURAL
419 Levels: 0FICIAL 1ª (OF. VARIOS) ABOGADOS/AS ADMINISTRATIVO ... VIGILANTE Y SERENO


For example, I need "ANIMADOR/A SOCIOCULTURAL" and "animador turistico" in the same name.
There are many of them.










share|improve this question


























  • Yes, but my problem is not always the word is written good...Sometimes in mayus, sometimes minus, and sometimes with other letters between it. And if I use gsub("Albañil","Albañil",datos$categorias)Only change first word, but not the others...And I need all word that looks like "Albañil" will be written in the same way.

    – Csf
    Mar 28 at 20:18











  • My experience is that this kind of problem usually just involves a lot of attempts. You may want to consider these functions to make the data more homogenous: toupper, trimws, gsub(pattern = 'R/A', replacement = 'R', x = , ignore.case = TRUE)

    – svenhalvorson
    Mar 28 at 20:27

















0















Goal:
I want to recode the values of a character variable. I need to simplify values which repeat all the time with differents ways, but I can't.



Problem:
When I change this values, codes overlap.



My Data:



> datos[c(1:30),"categorias"]
[1] 0FICIAL 1ª (OF. VARIOS) ABOGADOS/AS ABOGADOS/AS
[4] ADMINISTRATIVO ADMINISTRATIVO ADMINISTRATIVO
[7] ADMINISTRATIVO ADMINISTRATIVO OFICIAL DE PRIMERA Administrativo. Personal
[10] Administrativo. Personal Administrativo/a Albañil
[13] Albañil Oficial 1ª Albañil Oficial 1ª ANIMADOR COMUNITARIO
[16] ANIMADOR SOCIOCULTURAL ANIMADOR SOCIOCULTURAL ANIMADOR SOCIOCULTURAL
[19] ANIMADOR SOCIOCULTURAL ANIMADOR SOCIOCULTURAL ANIMADOR SOCIOCULTURAL
[22] ANIMADOR SOCIOCULTURAL ANIMADOR SOCIOCULTURAL ANIMADOR SOCIOCULTURAL
[25] ANIMADOR SOCIOCULTURAL animador turistico ANIMADOR/A
[28] ANIMADOR/A SOCIOCULTURAL ANIMADOR/A SOCIOCULTURAL ANIMADOR/A SOCIOCULTURAL
419 Levels: 0FICIAL 1ª (OF. VARIOS) ABOGADOS/AS ADMINISTRATIVO ... VIGILANTE Y SERENO


For example, I need "ANIMADOR/A SOCIOCULTURAL" and "animador turistico" in the same name.
There are many of them.










share|improve this question


























  • Yes, but my problem is not always the word is written good...Sometimes in mayus, sometimes minus, and sometimes with other letters between it. And if I use gsub("Albañil","Albañil",datos$categorias)Only change first word, but not the others...And I need all word that looks like "Albañil" will be written in the same way.

    – Csf
    Mar 28 at 20:18











  • My experience is that this kind of problem usually just involves a lot of attempts. You may want to consider these functions to make the data more homogenous: toupper, trimws, gsub(pattern = 'R/A', replacement = 'R', x = , ignore.case = TRUE)

    – svenhalvorson
    Mar 28 at 20:27













0












0








0








Goal:
I want to recode the values of a character variable. I need to simplify values which repeat all the time with differents ways, but I can't.



Problem:
When I change this values, codes overlap.



My Data:



> datos[c(1:30),"categorias"]
[1] 0FICIAL 1ª (OF. VARIOS) ABOGADOS/AS ABOGADOS/AS
[4] ADMINISTRATIVO ADMINISTRATIVO ADMINISTRATIVO
[7] ADMINISTRATIVO ADMINISTRATIVO OFICIAL DE PRIMERA Administrativo. Personal
[10] Administrativo. Personal Administrativo/a Albañil
[13] Albañil Oficial 1ª Albañil Oficial 1ª ANIMADOR COMUNITARIO
[16] ANIMADOR SOCIOCULTURAL ANIMADOR SOCIOCULTURAL ANIMADOR SOCIOCULTURAL
[19] ANIMADOR SOCIOCULTURAL ANIMADOR SOCIOCULTURAL ANIMADOR SOCIOCULTURAL
[22] ANIMADOR SOCIOCULTURAL ANIMADOR SOCIOCULTURAL ANIMADOR SOCIOCULTURAL
[25] ANIMADOR SOCIOCULTURAL animador turistico ANIMADOR/A
[28] ANIMADOR/A SOCIOCULTURAL ANIMADOR/A SOCIOCULTURAL ANIMADOR/A SOCIOCULTURAL
419 Levels: 0FICIAL 1ª (OF. VARIOS) ABOGADOS/AS ADMINISTRATIVO ... VIGILANTE Y SERENO


For example, I need "ANIMADOR/A SOCIOCULTURAL" and "animador turistico" in the same name.
There are many of them.










share|improve this question
















Goal:
I want to recode the values of a character variable. I need to simplify values which repeat all the time with differents ways, but I can't.



Problem:
When I change this values, codes overlap.



My Data:



> datos[c(1:30),"categorias"]
[1] 0FICIAL 1ª (OF. VARIOS) ABOGADOS/AS ABOGADOS/AS
[4] ADMINISTRATIVO ADMINISTRATIVO ADMINISTRATIVO
[7] ADMINISTRATIVO ADMINISTRATIVO OFICIAL DE PRIMERA Administrativo. Personal
[10] Administrativo. Personal Administrativo/a Albañil
[13] Albañil Oficial 1ª Albañil Oficial 1ª ANIMADOR COMUNITARIO
[16] ANIMADOR SOCIOCULTURAL ANIMADOR SOCIOCULTURAL ANIMADOR SOCIOCULTURAL
[19] ANIMADOR SOCIOCULTURAL ANIMADOR SOCIOCULTURAL ANIMADOR SOCIOCULTURAL
[22] ANIMADOR SOCIOCULTURAL ANIMADOR SOCIOCULTURAL ANIMADOR SOCIOCULTURAL
[25] ANIMADOR SOCIOCULTURAL animador turistico ANIMADOR/A
[28] ANIMADOR/A SOCIOCULTURAL ANIMADOR/A SOCIOCULTURAL ANIMADOR/A SOCIOCULTURAL
419 Levels: 0FICIAL 1ª (OF. VARIOS) ABOGADOS/AS ADMINISTRATIVO ... VIGILANTE Y SERENO


For example, I need "ANIMADOR/A SOCIOCULTURAL" and "animador turistico" in the same name.
There are many of them.







r data-cleaning






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 28 at 20:50









PoGibas

19.2k16 gold badges51 silver badges83 bronze badges




19.2k16 gold badges51 silver badges83 bronze badges










asked Mar 28 at 20:08









CsfCsf

334 bronze badges




334 bronze badges















  • Yes, but my problem is not always the word is written good...Sometimes in mayus, sometimes minus, and sometimes with other letters between it. And if I use gsub("Albañil","Albañil",datos$categorias)Only change first word, but not the others...And I need all word that looks like "Albañil" will be written in the same way.

    – Csf
    Mar 28 at 20:18











  • My experience is that this kind of problem usually just involves a lot of attempts. You may want to consider these functions to make the data more homogenous: toupper, trimws, gsub(pattern = 'R/A', replacement = 'R', x = , ignore.case = TRUE)

    – svenhalvorson
    Mar 28 at 20:27

















  • Yes, but my problem is not always the word is written good...Sometimes in mayus, sometimes minus, and sometimes with other letters between it. And if I use gsub("Albañil","Albañil",datos$categorias)Only change first word, but not the others...And I need all word that looks like "Albañil" will be written in the same way.

    – Csf
    Mar 28 at 20:18











  • My experience is that this kind of problem usually just involves a lot of attempts. You may want to consider these functions to make the data more homogenous: toupper, trimws, gsub(pattern = 'R/A', replacement = 'R', x = , ignore.case = TRUE)

    – svenhalvorson
    Mar 28 at 20:27
















Yes, but my problem is not always the word is written good...Sometimes in mayus, sometimes minus, and sometimes with other letters between it. And if I use gsub("Albañil","Albañil",datos$categorias)Only change first word, but not the others...And I need all word that looks like "Albañil" will be written in the same way.

– Csf
Mar 28 at 20:18





Yes, but my problem is not always the word is written good...Sometimes in mayus, sometimes minus, and sometimes with other letters between it. And if I use gsub("Albañil","Albañil",datos$categorias)Only change first word, but not the others...And I need all word that looks like "Albañil" will be written in the same way.

– Csf
Mar 28 at 20:18













My experience is that this kind of problem usually just involves a lot of attempts. You may want to consider these functions to make the data more homogenous: toupper, trimws, gsub(pattern = 'R/A', replacement = 'R', x = , ignore.case = TRUE)

– svenhalvorson
Mar 28 at 20:27





My experience is that this kind of problem usually just involves a lot of attempts. You may want to consider these functions to make the data more homogenous: toupper, trimws, gsub(pattern = 'R/A', replacement = 'R', x = , ignore.case = TRUE)

– svenhalvorson
Mar 28 at 20:27












0






active

oldest

votes














Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/4.0/"u003ecc by-sa 4.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);














draft saved

draft discarded
















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55406052%2fhow-to-change-values-in-character-variable-in-r%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55406052%2fhow-to-change-values-in-character-variable-in-r%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

은진 송씨 목차 역사 본관 분파 인물 조선 왕실과의 인척 관계 집성촌 항렬자 인구 같이 보기 각주 둘러보기 메뉴은진 송씨세종실록 149권, 지리지 충청도 공주목 은진현