简体   繁体   中英

R markdown can't knit

I finished a project in R markdown and all I have to do is knit it as a word document, but there's this message error that I can't understand where I have made the mistake.

Error in yaml::yaml.load(..., eval.expr = TRUE): Scanner error: mapping values are not allowed in this context at line 4, column 22 Calls: ... parse_yaml_front_matter -> yaml_load -> Execution halted

I looked at line 4 and it's just the date of the project and line 22 is an empty line so they're not the issue. Can anyone translate what the error means? Is it one of the chunk codes or any other error? Please and thank you These are the first 22 lines of the code(the language used is my country's language, just information):

---
title: "Diferencimi gjinor ne aspekte ekonomike dhe sociale ne Shqiperi"
author: "Selina Balla(lider), Sindi Gjura, Sara Osmrija"
date: "June 17, 2021"
output: word_document: default
---
# "Diferencimi gjinor ne aspekte ekonomike dhe sociale ne Shqiperi"
### Hyrje
Pabarazia prek cdo fushe te jetes. Statistikat gjinore reflektojne ndryshimet ose pabarazite e situates se burrave dhe grave ne spektra te ndryshem. Gjendja e meshkujve dhe femrave tregohet me ane te statistikave ne fusha te tilla si popullsia, arsimi, tregu i punes, perfshirja sociale, shendetesia dhe vendimmarrja. Njohja e situates se femrave dhe meshkujve ne shoqeri, ne te gjitha sferat e jetes orienton politikberesit drejt vendimarrjeve te duhura mbi keto politika. 
Nentemat e perzgjedhura per tu prezantuar pasqyrojne diferencimin ne fusha ekonomike apo sociale qe behet per shkak te gjinise se individeve. Paraqitjet grafikore do te jene celesi per te dalluar ritmet e arritjes se barazise gjinore ne Shqiperi. Te dhenat e marra perfshijne te gjithe popullsine e Shqiperise, nga e cila 50.17% jane femra dhe 49.83% meshkuj.


Fjale kyce: pabarazi, arsim, ekonomi, social.


### Qellimi
Permes ketij studimi, mendohet te arrihet nje ndergjegjesim tek ajo pjese e popullsise e cila ben diferencim te aftesive fizike, mendore etj. midis individeve ne baze te gjinise dhe jo vertete ne baze te kualifikimeve. Ajo qe sherben si nje nga qellimet primare te ketij projekti eshte nxitja e njerezve per te kundershtuar kete pabarazi, per te permiresuar kushtet aktuale te shoqerise. Ne kete menyre, arrihet nje diversitet ideologjik ne pikepamje te ndryshme te jetes. 



###Arsimi

Indentation and newlines are important in YAML, change your header to

---
title: "Diferencimi gjinor ne aspekte ekonomike dhe sociale ne Shqiperi"
author: "Selina Balla(lider), Sindi Gjura, Sara Osmrija"
date: "June 17, 2021"
output:
  word_document:
    default
---

Demonstration:

yaml::read_yaml(text='---
title: "Diferencimi gjinor ne aspekte ekonomike dhe sociale ne Shqiperi"
author: "Selina Balla(lider), Sindi Gjura, Sara Osmrija"
date: "June 17, 2021"
output: word_document: default
---')
# Error in yaml.load(string, error.label = error.label, ...) : 
#   Scanner error: mapping values are not allowed in this context at line 5, column 22

### fixed
yaml::read_yaml(text='---
title: "Diferencimi gjinor ne aspekte ekonomike dhe sociale ne Shqiperi"
author: "Selina Balla(lider), Sindi Gjura, Sara Osmrija"
date: "June 17, 2021"
output:
  word_document:
    default
---')
# $title
# [1] "Diferencimi gjinor ne aspekte ekonomike dhe sociale ne Shqiperi"
# $author
# [1] "Selina Balla(lider), Sindi Gjura, Sara Osmrija"
# $date
# [1] "June 17, 2021"
# $output
# $output$word_document
# [1] "default"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM