write.rss {animation} | R Documentation |
An RSS feed is essentially just an XML file, thus the creation is easy just with cat
to write some tags into a text file. The elments of an item in an RSS feed usually contains 'title', 'link', 'author', 'description', 'pubDate', 'guid', and 'category', etc, which are stored in the CSV data file.
write.rss(file = "feed.xml", entry = "rss.csv", xmlver = "1.0", rssver = "2.0", title = "What's New?", link = "http://R.yihui.name", description = "Animated Statistics Using R", language = "en-us", copyright = "Copyright 2007, Yihui Xie", pubDate = Sys.time(), lastBuildDate = Sys.time(), docs = "http://R.yihui.name", generator = "Function write.rss() in R package animation", managingEditor = "xieyihui[at]gmail.com", webMaster = "xieyihui[at]gmail.com", maxitem = 10, ...)
file |
the path of the output file (RSS feed); passed to cat |
entry |
the input CSV file, containing elements for items in the RSS feed (with tag names in the header); read.csv |
xmlver |
version of XML |
rssver |
version of RSS |
title |
The name of the channel. It's how people refer to your service. If you have an HTML website that contains the same information as your RSS file, the title of your channel should be the same as the title of your website. |
link |
The URL to the HTML website corresponding to the channel. |
description |
Phrase or sentence describing the channel. |
language |
The language the channel is written in. |
copyright |
Copyright notice for content in the channel. |
pubDate |
The publication date for the content in the channel. |
lastBuildDate |
The last time the content of the channel changed. |
docs |
A URL that points to the documentation for the format used in the RSS file. |
generator |
A string indicating the program used to generate the channel. |
managingEditor |
Email address for person responsible for editorial content. |
webMaster |
Email address for person responsible for technical issues relating to channel. |
maxitem |
Maximum number of items to be written into the feed. |
... |
other elements for the channel, e.g. image, cloud, etc. |
The items of the RSS feed are stored in the file ‘entry’, and the many arguments above are just for the channel information.
None. Only a message indicating where the RSS was created.
As the argument file
is passed to cat
, you may specify it as an empty string ""
so that the result will be printed to the standard output connection, the console unless redirected by 'sink'.
Note the order of items in the CSV file: newer items are added to the end of the file. But this order will be reversed in the RSS file!
Yihui Xie
Read http://cyber.law.harvard.edu/rss/rss.html for the specification of RSS.
# create rss feed from a sample file in 'animation' # to getwd() write.rss(entry = system.file("js", "rss.csv", package = "animation")) ## Not run: # Read entries from the internet write.rss(entry = "http://www.yihui.name/r/news/rss.csv") ## End(Not run)