首页 > 解决方案 > 如何将 cson 文件读入 R

问题描述

我遇到了一个 cson(CoffeeScript-Object-Notation)文件格式,我想将它导入 R。

cson_example <- "# Comments!!!

# An Array with no commas!
greatDocumentaries: [
'earthlings.com'
'forksoverknives.com'
'cowspiracy.com'
]

# An Object without braces!
importantFacts:
# Multi-Line Strings! Without Quote Escaping!
emissions: '''
Livestock and their byproducts account for at least 32,000 million tons of carbon dioxide (CO2) per year, or 51% of all worldwide greenhouse gas emissions.
Goodland, R Anhang, J. “Livestock and Climate Change: What if the key actors in climate change were pigs, chickens and cows?”
WorldWatch, November/December 2009. Worldwatch Institute, Washington, DC, USA. Pp. 10–19.
http://www.worldwatch.org/node/6294
'''

milk: '''
1,000 gallons of water are required to produce 1 gallon of milk.
“Water trivia facts.” United States Environmental Protection Agency.
http://water.epa.gov/learn/kids/drinkingwater/water_trivia_facts.cfm#_edn11
'''

more: 'http://cowspiracy.com/facts'"

是否有将 cson 文件导入 R 的可靠方法?

标签: rstringparsingcson

解决方案


推荐阅读