Load data frame with spanish characters into RStudio on Windows 10












2















I have the following data frame (saved as .RData):



Matemáticas <- c(sample(70:100, 10, replace=TRUE))
Química <- c(sample(70:100, 10, replace=TRUE))
notas <- data.frame(Matemáticas,Química)


When loading it to the Global Environment on my Mac, I have no problems. However, when I try to do so in Windows 10 on a PC (RStudio version 3.3.3), the variable names appear as such:



QuÃmica
Matemáticas


I have tried the following things:
1. I have already set the default text encoding to UTF-8 in Tools->Global Options -> Code -> Saving -> Default text encoding.
2. I tried changing the locale, with the following:



Sys.setlocale("LC_ALL",Spanish)
Sys.setlocale("LC_CTYPE",Spanish)


This changed the locale, when I checked with
Sys.getlocale()
but the accents still appeared.




  1. I tried changing the encoding of the data frame itself with
    Encoding(notas) <- "UTF-8"
    This did not work because (I suspect) I have to do a sapply or something...


Most of the information I have found online is in reference to reading spanish characters when reading a csv file, but my file is in .RData already.



What I would like is for Windows to ALWAYS recognize spanish accents, as most of my work is in this language.










share|improve this question

























  • Can you try to save your df in a csv (on Windows) and then load it (on Mac)?

    – Roman
    Nov 26 '18 at 20:07













  • I could, but would prefer a solution with the .RData file...I need it to work on both computers as .RData because its part of a knitr file, so when compiling it I don't wan't an extra step.

    – Juliana Gómez
    Nov 27 '18 at 17:20











  • I some cases (esp. OSX <10.10) Rstudio can show characters with wrong encoding, but it sometimes is merely a frontend issue. Can you check if your data is saved properly? (i.e. if it affects the underlying data)

    – Roman
    Nov 28 '18 at 11:21













  • But the characters appear ok on my mac, and everything runs smoothly. The problem is only on WIndows on a PC

    – Juliana Gómez
    Nov 28 '18 at 14:30
















2















I have the following data frame (saved as .RData):



Matemáticas <- c(sample(70:100, 10, replace=TRUE))
Química <- c(sample(70:100, 10, replace=TRUE))
notas <- data.frame(Matemáticas,Química)


When loading it to the Global Environment on my Mac, I have no problems. However, when I try to do so in Windows 10 on a PC (RStudio version 3.3.3), the variable names appear as such:



QuÃmica
Matemáticas


I have tried the following things:
1. I have already set the default text encoding to UTF-8 in Tools->Global Options -> Code -> Saving -> Default text encoding.
2. I tried changing the locale, with the following:



Sys.setlocale("LC_ALL",Spanish)
Sys.setlocale("LC_CTYPE",Spanish)


This changed the locale, when I checked with
Sys.getlocale()
but the accents still appeared.




  1. I tried changing the encoding of the data frame itself with
    Encoding(notas) <- "UTF-8"
    This did not work because (I suspect) I have to do a sapply or something...


Most of the information I have found online is in reference to reading spanish characters when reading a csv file, but my file is in .RData already.



What I would like is for Windows to ALWAYS recognize spanish accents, as most of my work is in this language.










share|improve this question

























  • Can you try to save your df in a csv (on Windows) and then load it (on Mac)?

    – Roman
    Nov 26 '18 at 20:07













  • I could, but would prefer a solution with the .RData file...I need it to work on both computers as .RData because its part of a knitr file, so when compiling it I don't wan't an extra step.

    – Juliana Gómez
    Nov 27 '18 at 17:20











  • I some cases (esp. OSX <10.10) Rstudio can show characters with wrong encoding, but it sometimes is merely a frontend issue. Can you check if your data is saved properly? (i.e. if it affects the underlying data)

    – Roman
    Nov 28 '18 at 11:21













  • But the characters appear ok on my mac, and everything runs smoothly. The problem is only on WIndows on a PC

    – Juliana Gómez
    Nov 28 '18 at 14:30














2












2








2


1






I have the following data frame (saved as .RData):



Matemáticas <- c(sample(70:100, 10, replace=TRUE))
Química <- c(sample(70:100, 10, replace=TRUE))
notas <- data.frame(Matemáticas,Química)


When loading it to the Global Environment on my Mac, I have no problems. However, when I try to do so in Windows 10 on a PC (RStudio version 3.3.3), the variable names appear as such:



QuÃmica
Matemáticas


I have tried the following things:
1. I have already set the default text encoding to UTF-8 in Tools->Global Options -> Code -> Saving -> Default text encoding.
2. I tried changing the locale, with the following:



Sys.setlocale("LC_ALL",Spanish)
Sys.setlocale("LC_CTYPE",Spanish)


This changed the locale, when I checked with
Sys.getlocale()
but the accents still appeared.




  1. I tried changing the encoding of the data frame itself with
    Encoding(notas) <- "UTF-8"
    This did not work because (I suspect) I have to do a sapply or something...


Most of the information I have found online is in reference to reading spanish characters when reading a csv file, but my file is in .RData already.



What I would like is for Windows to ALWAYS recognize spanish accents, as most of my work is in this language.










share|improve this question
















I have the following data frame (saved as .RData):



Matemáticas <- c(sample(70:100, 10, replace=TRUE))
Química <- c(sample(70:100, 10, replace=TRUE))
notas <- data.frame(Matemáticas,Química)


When loading it to the Global Environment on my Mac, I have no problems. However, when I try to do so in Windows 10 on a PC (RStudio version 3.3.3), the variable names appear as such:



QuÃmica
Matemáticas


I have tried the following things:
1. I have already set the default text encoding to UTF-8 in Tools->Global Options -> Code -> Saving -> Default text encoding.
2. I tried changing the locale, with the following:



Sys.setlocale("LC_ALL",Spanish)
Sys.setlocale("LC_CTYPE",Spanish)


This changed the locale, when I checked with
Sys.getlocale()
but the accents still appeared.




  1. I tried changing the encoding of the data frame itself with
    Encoding(notas) <- "UTF-8"
    This did not work because (I suspect) I have to do a sapply or something...


Most of the information I have found online is in reference to reading spanish characters when reading a csv file, but my file is in .RData already.



What I would like is for Windows to ALWAYS recognize spanish accents, as most of my work is in this language.







r utf-8






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 28 '18 at 14:31







Juliana Gómez

















asked Nov 26 '18 at 18:37









Juliana GómezJuliana Gómez

4516




4516













  • Can you try to save your df in a csv (on Windows) and then load it (on Mac)?

    – Roman
    Nov 26 '18 at 20:07













  • I could, but would prefer a solution with the .RData file...I need it to work on both computers as .RData because its part of a knitr file, so when compiling it I don't wan't an extra step.

    – Juliana Gómez
    Nov 27 '18 at 17:20











  • I some cases (esp. OSX <10.10) Rstudio can show characters with wrong encoding, but it sometimes is merely a frontend issue. Can you check if your data is saved properly? (i.e. if it affects the underlying data)

    – Roman
    Nov 28 '18 at 11:21













  • But the characters appear ok on my mac, and everything runs smoothly. The problem is only on WIndows on a PC

    – Juliana Gómez
    Nov 28 '18 at 14:30



















  • Can you try to save your df in a csv (on Windows) and then load it (on Mac)?

    – Roman
    Nov 26 '18 at 20:07













  • I could, but would prefer a solution with the .RData file...I need it to work on both computers as .RData because its part of a knitr file, so when compiling it I don't wan't an extra step.

    – Juliana Gómez
    Nov 27 '18 at 17:20











  • I some cases (esp. OSX <10.10) Rstudio can show characters with wrong encoding, but it sometimes is merely a frontend issue. Can you check if your data is saved properly? (i.e. if it affects the underlying data)

    – Roman
    Nov 28 '18 at 11:21













  • But the characters appear ok on my mac, and everything runs smoothly. The problem is only on WIndows on a PC

    – Juliana Gómez
    Nov 28 '18 at 14:30

















Can you try to save your df in a csv (on Windows) and then load it (on Mac)?

– Roman
Nov 26 '18 at 20:07







Can you try to save your df in a csv (on Windows) and then load it (on Mac)?

– Roman
Nov 26 '18 at 20:07















I could, but would prefer a solution with the .RData file...I need it to work on both computers as .RData because its part of a knitr file, so when compiling it I don't wan't an extra step.

– Juliana Gómez
Nov 27 '18 at 17:20





I could, but would prefer a solution with the .RData file...I need it to work on both computers as .RData because its part of a knitr file, so when compiling it I don't wan't an extra step.

– Juliana Gómez
Nov 27 '18 at 17:20













I some cases (esp. OSX <10.10) Rstudio can show characters with wrong encoding, but it sometimes is merely a frontend issue. Can you check if your data is saved properly? (i.e. if it affects the underlying data)

– Roman
Nov 28 '18 at 11:21







I some cases (esp. OSX <10.10) Rstudio can show characters with wrong encoding, but it sometimes is merely a frontend issue. Can you check if your data is saved properly? (i.e. if it affects the underlying data)

– Roman
Nov 28 '18 at 11:21















But the characters appear ok on my mac, and everything runs smoothly. The problem is only on WIndows on a PC

– Juliana Gómez
Nov 28 '18 at 14:30





But the characters appear ok on my mac, and everything runs smoothly. The problem is only on WIndows on a PC

– Juliana Gómez
Nov 28 '18 at 14:30












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/3.0/"u003ecc by-sa 3.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%2f53487127%2fload-data-frame-with-spanish-characters-into-rstudio-on-windows-10%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%2f53487127%2fload-data-frame-with-spanish-characters-into-rstudio-on-windows-10%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

A CLEAN and SIMPLE way to add appendices to Table of Contents and bookmarks

Calculate evaluation metrics using cross_val_predict sklearn

Insert data from modal to MySQL (multiple modal on website)