Search code examples
rrstudior-markdownknitrrnotebook

Knitr weird problem with output languages


So I'm doing a report using Rmarkdown in Rstudio. Naturally, using Knitr to get the outputs. For the PDF output, I installed the tinytex package.

The report is in english, so I'd like the date format to be in english.

This is the start of the document:

---
title: "MyTitle"
subtitle: "Assignment 3"
date: "`r as.character(Sys.time(), '%d %B')`"
author: "MyName"
output:

  html_document:
    df_print: paged
    theme: paper
    highlight: tango
  pdf_document: default
  html_notebook: default
---

I put that command there to automatically get the present date.

Now to the funny part. If I click in "preview notebook" on the Knitr dropdown menu, it shows:

MyTitle
Assignment 3
MyName
27 February
First, the csv with the data is read.

Mind the language of the month, this is important. The language here is english. All good. Now if I want to output it in PDF or HTML I get:

MyTitle
Assignment 3
MyName
27 fevereiro
First, the csv with the data is read.

The month language is now in portuguese, which I suppose is the language got installed in. Also my keyboard language, if that matters.

Question is: How can I have an english output on PDFs and HTML? Thanks

========================

Found an answer!

My SO is windows 10.

  1. I went to the Windows Settings window, choose "Time and Language"
  2. Clicked on the "Region" button on the left hand side
  3. Chose "English (Germany)" on the drop-down menu 'Current format' under the 'Regional Format' part.

Wish this is useful to someone who reads this question in the future :)


Solution

  • Found an answer!

    My SO is windows 10.

    1. I went to the Windows Settings window, choose "Time and Language"
    2. Clicked on the "Region" button on the left hand side
    3. Chose "English (Germany)" on the drop-down menu 'Current format' under the 'Regional Format' part.

    Wish this is useful to someone who reads this question in the future :)