2015-10-05 4 views
12

के उपयोग के साथ RMarkdown दस्तावेज़ में ग्रंथसूची समेत मैं knitcitations का उपयोग करने की कोशिश कर रहा हूं और आर मार्कडाउन दस्तावेज़ में ग्रंथसूची जोड़ता हूं जिसे मैं आर स्टूडियो में प्रारूपित कर रहा हूं। मेरे दस्तावेज़ के शीर्ष लेख इस तरह दिखता है:knitcitations

--- 
title: "Some Title" 
author: "Me" 
date: "September 2015" 
bibliography: bibliography.bib 
output: 
    pdf_document: 
    highlight: tango 
    number_sections: yes 
    toc: yes 
--- 

मैं निम्नलिखित कोड का उपयोग कर अंत में ग्रंथ सूची जोड़ना चाहते हैं:

```{r generateBibliography, echo=FALSE, eval=TRUE, message=FALSE, warning=FALSE} 
require("knitcitations") 
cleanbib() 
options("citation_format" = "pandoc") 
read.bibtex(file = "bibliography.bib") 
``` 

संदर्भ फ़ाइल bibliography.bib निम्नलिखित सामग्री है:

@article{debarsy_testing_2010, 
    title = {Testing for spatial autocorrelation in a fixed effects panel data model}, 
    volume = {40}, 
    issn = {0166-0462}, 
    url = {http://www.sciencedirect.com/science/article/pii/S0166046210000451}, 
    doi = {10.1016/j.regsciurbeco.2010.06.001}, 
    abstract = {The aim of this paper is to assess the relevance of spatial autocorrelation in a fixed effects panel data model and in the affirmative, to identify the most appropriate spatial specification as this appears to be a crucial point from the modeling perspective of interactive heterogeneity. Several {LM} test statistics as well as their {LR} counterparts, which allow discriminating between endogenous spatial lag versus spatially autocorrelated errors, are therefore proposed. Monte Carlo experiments show their good finite sample performance. Finally, an empirical application is provided in the framework of the well-known Feldstein–Horioka puzzle.}, 
    pages = {453--470}, 
    number = {6}, 
    journaltitle = {Regional Science and Urban Economics}, 
    shortjournal = {Regional Science and Urban Economics}, 
    author = {Debarsy, Nicolas and Ertur, Cem}, 
    urldate = {2015-10-01}, 
    date = {2010-11}, 
    keywords = {Panel data, Spatial autocorrelation, Test statistics}, 
    file = {complex_zotero_path} 
} 

@article{lamichhane_spatial-temporal_2015, 
    title = {Spatial-Temporal Modeling of Neighborhood Sociodemographic Characteristics and Food Stores}, 
    volume = {181}, 
    issn = {0002-9262, 1476-6256}, 
    url = {http://aje.oxfordjournals.org/content/181/2/137}, 
    doi = {10.1093/aje/kwu250}, 
    abstract = {The literature on food stores, neighborhood poverty, and race/ethnicity is mixed and lacks methods of accounting for complex spatial and temporal clustering of food resources. We used quarterly data on supermarket and convenience store locations from Nielsen {TDLinx} (Nielsen Holdings N.V., New York, New York) spanning 7 years (2006–2012) and census tract-based neighborhood sociodemographic data from the American Community Survey (2006–2010) to assess associations between neighborhood sociodemographic characteristics and food store distributions in the Metropolitan Statistical Areas ({MSAs}) of 4 {US} cities (Birmingham, Alabama; Chicago, Illinois; Minneapolis, Minnesota; and San Francisco, California). We fitted a space-time Poisson regression model that accounted for the complex spatial-temporal correlation structure of store locations by introducing space-time random effects in an intrinsic conditionally autoregressive model within a Bayesian framework. After accounting for census tract–level area, population, their interaction, and spatial and temporal variability, census tract poverty was significantly and positively associated with increasing expected numbers of supermarkets among tracts in all 4 {MSAs}. A similar positive association was observed for convenience stores in Birmingham, Minneapolis, and San Francisco; in Chicago, a positive association was observed only for predominantly white and predominantly black tracts. Our findings suggest a positive association between greater numbers of food stores and higher neighborhood poverty, with implications for policy approaches related to food store access by neighborhood poverty.}, 
    pages = {137--150}, 
    number = {2}, 
    journaltitle = {American Journal of Epidemiology}, 
    shortjournal = {Am. J. Epidemiol.}, 
    author = {Lamichhane, Archana P. and Warren, Joshua L. and Peterson, Marc and Rummo, Pasquale and Gordon-Larsen, Penny}, 
    urldate = {2015-10-01}, 
    date = {2015-01-15}, 
    langid = {english}, 
    pmid = {25515169}, 
    keywords = {food availability, food stores, intrinsic conditionally autoregressive model, neighborhood characteristics, Poverty, sociodemographic factors, spatial-temporal modeling, supermarkets}, 
    file = {complex_zotero_path} 
} 

हालांकि, उत्पादित आउटपुट टिप्पणी के रूप में दिखाई देता है, ग्रंथसूची प्रविष्टि के रूप में नहीं: sample entries

फ़ाइल इस कोड के साथ संकलित किया गया है:

"C:/Program Files/RStudio/bin/pandoc/pandoc" +RTS -K512m -RTS _paper.md --to latex 
--from markdown+autolink_bare_uris+ascii_identifiers+tex_math_single_backslash-implicit_figures 
--output _paper.pdf --filter pandoc-citeproc --table-of-contents --toc-depth 2 --template "path_\latex\default.tex" 
--number-sections --highlight-style tango --latex-engine pdflatex --variable "geometry:margin=1in" --bibliography bibliography.bib 

संक्षिप्तता के लिए, मैं _paper और _paper लिए पथ बदल दिया है।


जब मैं advice on including bibliography in RStudio दस्तावेज़ सभी में कोई ग्रंथ सूची प्रविष्टियों के साथ उत्पादन किया गया था का पालन करने की कोशिश की। इसलिए मेरा प्रश्न, जहां मैं गलती कर रहा हूं और मैं RStudio में काम करते समय ग्रंथसूची प्रविष्टियों की पीढ़ी को कैसे मजबूर कर सकता हूं?

संपादित

बहुत उपयोगी टिप्पणियों के बाद आदर्श मैं स्पष्ट रूप से संलग्न दस्तावेज में उद्धृत काम करता है का संकेत से बचने के लिए चाहते हैं। वास्तव में, मुझे ग्रंथसूची समेत दिलचस्पी है जिसमें कुछ उद्धृत कार्य शामिल होंगे लेकिन कागजात जो मुख्य दस्तावेज़ से प्रासंगिक हैं लेकिन दस्तावेज़ में स्पष्ट रूप से संदर्भित नहीं हैं।

+1

शायद आपको 'csl' फ़ाइल भी आपूर्ति करने की आवश्यकता है? – zx8754

+1

@ zx8754 मेरी समझ यह थी कि 'csl' फ़ाइल केवल विशिष्ट शैली आवश्यकताओं के मामले में प्रदान की जाती है। इस समय, मुझे केवल प्रासंगिक प्रकाशनों की सूची संलग्न करने में दिलचस्पी है। जैसे ही यह पाठकों को प्रासंगिक काम खोजने में मदद करता है, मैं किसी भी संदर्भ शैली के साथ रह सकता हूं। – Konrad

+0

हां, आप सही हैं 'सीएसएल' प्रारूप शैली के लिए है, क्षमा करें, मैं अभी भी पुनरुत्पादित शोध दुनिया में अपने बच्चे के कदमों पर हूं। – zx8754

उत्तर

11

pandoc documentation का कहना है:

आप वास्तव में उन्हें मुख्य पाठ में हवाला देते हुए बिना ग्रंथ सूची में आइटम शामिल करना चाहते हैं, तो आप एक डमी nocite मेटाडाटा क्षेत्र को परिभाषित करने और वहाँ प्रशंसा पत्र डाल सकते हैं:

--- 
nocite: | 
    @item1, @item2 
... 

@item3 

इस उदाहरण में, दस्तावेज़ में केवल आइटम 3 के लिए उद्धरण होगा, लेकिन ग्रंथसूची में आइटम 1, आइटम 2 और आइटम 3 के लिए प्रविष्टियां होंगी।

+0

यही वह है जो मैं करना चाहता हूं, लेकिन यह "nocite: |" कहां है चले जाओ? मैंने इसे अपनी ग्रंथसूची फ़ाइल में रखा लेकिन यह काम नहीं किया और यह मेरे मार्कडाउन दस्तावेज़ में भी काम नहीं कर रहा है। शीर्ष पर 3 डैश आवश्यक हैं? और, क्या किसी अन्य वर्टिकल बार की तरह, नोसाइट सेक्शन को बंद करने के लिए कुछ भी आवश्यक है? मुझे लगता है कि यह RStudio दस्तावेज़ पृष्ठ से कॉपी किया गया है, लेकिन मुझे अपने प्रश्न का उत्तर देने के लिए कोई अतिरिक्त जानकारी नहीं मिली। – svannoy

11

यहाँ कम से कम काम कर रहे उदाहरण है:

paper.Rmd

--- 
title: 'My Title' 
author: "Me me me me!" 
output: pdf_document 
bibliography: references.bib 
--- 

Application written in the R programming language [@RCoreTeam] using the Shiny framework [@Chang2015]. 

# REFERENCES 

references.bib

@Misc{Chang2015, 
    Title     = {shiny: Web Application Framework for R. R package version 0.12.1}, 

    Author     = {Chang, W. and Cheng, J. and Allaire, JJ. and Xie, Y. and McPherson, J. }, 
    Year      = {2015}, 

    Type      = {Computer Program}, 
    Url      = {http://CRAN.R-project.org/package=shiny} 
} 


@Article{RCoreTeam, 
    Title     = {R: A Language and Environment for Statistical Computing}, 
    Author     = {{R Core Team}}, 
    Year      = {2015}, 

    Type      = {Journal Article}, 
    Url      = {http://www.R-project.org} 
} 

कंसोल आउटपुट

processing file: paper.Rmd 
"C:/Program Files/RStudio/bin/pandoc/pandoc" +RTS -K512m -RTS paper.utf8.md --to latex --from markdown+autolink_bare_uris+ascii_identifiers+tex_math_single_backslash-implicit_figures --output paper.pdf --filter pandoc-citeproc --template "C:\Users\tdadaev\Documents\R\win-library\3.2\rmarkdown\rmd\latex\default.tex" --highlight-style tango --latex-engine pdflatex --variable "geometry:margin=1in" --bibliography references.bib 
output file: paper.knit.md 


Output created: paper.pdf 

कागज।पीडीएफ enter image description here

+0

मेरी पोस्ट में रुचि दिखाने और टिप्पणियां प्रदान करने के लिए बहुत बहुत धन्यवाद। दस्तावेज़ में चमकदार ढांचे [@ चांग2015] .' का उपयोग करके '[@RCoreTeam] को वास्तव में शामिल करना आवश्यक है? वास्तव में, मैं बस ग्रंथसूची को संदर्भों की सूची नहीं जोड़ना चाहता हूं। ऐसे कुछ कागजात हैं जो सामग्री के लिए प्रासंगिक हैं लेकिन टेक्स्ट में सीधे इसका उल्लेख नहीं किया गया है। यदि यह एकमात्र तरीका है, तो मैं हमेशा वाक्य को दोहरा सकता हूं और इन-टेक्स्ट उद्धरण शामिल कर सकता हूं लेकिन प्रासंगिक कार्यों की सूची जोड़ने के साथ मैं बहुत खुश हूं। – Konrad

+1

@ कोनराड अब मैं आपकी समस्या को इस बिंदु को जोड़ने के लायक, रोचक, रोचक देखता हूं। – zx8754

+2

@ कोनराड मुझे लगता है कि इसे टेक्स्ट में उल्लेख किया जाना चाहिए, विचार है कि '.bib' फ़ाइल में सैकड़ों रिफ्रेंस हो सकते हैं, लेकिन केवल' .rmd' फ़ाइल में उल्लिखित लोगों को पीडीएफ आउटपुट में संदर्भ के रूप में संकलित किया जाता है। – zx8754