graph

Export a Table Created by R to a TeX File

Producing tables in LaTeX might be a difficult task as we can not just copy and paste a table in the editor; we have to write all the numbers and other codes. But with the help of xtable package of R it is possible to produce all the necessary codes for producing table in LaTeX and also possible to export the codes in a tex file. Suppose we have produced summary statistics for Air Pollution Data and now want to export it to a tex file as a tabular format. Here are the codes-

library(xtable)
data<-read.table("data_air.txt", header=T)
data<-data[,1:4]
s<-summary(data)

Three dimensional plots using rgl package

We all know that R can do amazing things including 3 dimensional plots. scatterplot3d is probably the most popular package for doing this. But a few days ago I got introduced with rgl package which can do 3 dimensional graphs with some added advantages like we can rotate the plot using mouse, zoom in or out using the mouse scroll wheel and even can play beautiful animations.
The data I have used for all the examples here is-

How to do this graph using R

I am showing three examples that will help an average R user to create beautiful graphs. The interesting (may be useful) parts of these examples are the use of some very smart but tricky functions to, for example, add a Greek symbol on a plot, add a title to a plot with some mathematical symbols. In these examples I used expression and paste functions repeatedly. For more examples please see this site.

Subscribe to RSS - graph