Learn R Programming

animation (version 0.2-0)

write.rss: Create RSS feed from a CSV data file

Description

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.

Usage

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, ...)

Arguments

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.

Value

  • None. Only a message indicating where the RSS was created.

Details

The items of the RSS feed are stored in the file entry, and the many arguments above are just for the channel information.

References

Read http://cyber.law.harvard.edu/rss/rss.html for the specification of RSS.

See Also

cat, read.csv

Examples

Run this code
# create rss feed from a sample file in 'animation' 
# to getwd() 
write.rss(entry = system.file("js", "rss.csv", package = "animation")) 

# Read entries from the internet 
write.rss(entry = "http://r.yihui.name/news/rss.csv")

Run the code above in your browser using DataLab