Learn R Programming

mgraph (version 1.03)

piemap: Pie chart of spatial and non spatial data

Description

The piemap function plots an attribute of a map and non-map data. It also returns tabular data: frequencies

Usage

piemap(source,layer='',attribute,type='',label="",col='') "piemap"(source,layer='',attribute,type='',label="",col='') "print"(x,...) "summary"(object,...) "plot"(x,...)

Arguments

source
Folder path of the layer or the map. Please quote the full folder path with forward slash "/".
layer
The layer map in the folder that you want to work with. It is the file name of map. This is case sensitive, please. In case you want to use non spatial data such as ".csv", ".txt", "dat" or ".tab" insert the file name as layer. In case of using R object set layer to "nofile"
type
The type of pie chart you want to use. It can take "simple" or "annotated" parameter. Simple pie chart does not have annotation. Set the "type" to "map" if you want a map to be drawn for the attribute
attribute
The attribute name of the layer or the map you want use. In case of using non spatial data such as ".csv", ".txt", "dat" or ".tab" attributes are variables or column names
label
The labeling title of the chart.
col
The colour of the chart
x
an object of class "piemap", i.e., a fitted model.
object
an object of class "piemap", i.e., a fitted model.
...
any other R parameters can be added

Value

Objects of the class that basically list its elements
data
Original data for the model
table
Frequency of the original data
source
Folder path of the layer or map
layer
The layer map in the source folder
attribute
The attribute name of the layer or the map that was used.
label
The labeling title of the chart.

References

Bivand, R. S., Pebesma, E. J., Gomez-Rubio, V. (2008) Applied Spatial Data Analysis with R. Springer Kabacoff, I. R. (2011) R in Action. Data Analysis and Graphics with R. Manning Publications Co

Examples

Run this code
## Not run: 
# #example one non spatial data
# source<- system.file("external", package = "mgraph")
# layer="farms"
# attribute="Variety"
# graph=piemap(source, layer,type="annotated",attribute=attribute,col='black',label="")
# summary(graph)
# print(graph)
# plot(graph)
# 
# #Example two with R object
# data(meuse.all, package="gstat")
# piemap(source=meuse.all,layer="nofile",attribute="landuse")
# piemap(source=meuse.all,layer="nofile",attribute="lime")
# ## End(Not run)

Run the code above in your browser using DataLab