create_Points: Create Points

Description Usage Arguments Value See Also Examples

View source: R/create.R

Description

Create Points to display point locations. Buffering points may be used to produce bubble charts.

Usage

1
2
3
4
5
6
7
8
9
create_Points(
  Input,
  OutputFormat = "ROBJECT",
  OutputName = NULL,
  Buffer = 0,
  Clip = FALSE,
  SeparateBuf = TRUE,
  NamesIn = NULL
)

Arguments

Input

the name of the Input data as a .csv file or an R dataframe. If a .csv file is used as input, this file must be in your working directory and its name given in quotes e.g. "DataFile.csv".

If NamesIn is not provided, the columns in the Input must be in the following order:

Latitude, Longitude, Variable 1, Variable 2, ... Variable x

OutputFormat

can be an R object or an ESRI Shapefile. if OutputFormat is specified as "ROBJECT" (the default), a spatial object is created in your R environment. if OutputFormat is specified as "SHAPEFILE", an ESRI Shapefile is exported in your working directory.

OutputName

if OutputFormat is specified as "SHAPEFILE", the name of the output shapefile in quotes (e.g. "MyPoints") must be provided.

Buffer

Radius in nautical miles by which to expand the points. Can be specified for each point (as a numeric vector).

Clip

if set to TRUE, polygon parts (from buffered points) that fall on land are removed (see Clip2Coast).

SeparateBuf

If set to FALSE when adding a Buffer, all spatial objects are merged, resulting in a single spatial object.

NamesIn

character vector of length 2 specifying the column names of Latitude and Longitude fields in the Input. Latitudes name must be given first, e.g.:

NamesIn=c('MyLatitudes','MyLongitudes').

Value

Spatial object in your environment or ESRI shapefile in your working directory. Data within the resulting spatial object contains the data provided in the Input plus additional "x" and "y" columns which corresponds to the projected points locations and may be used to label points (see examples).

To see the data contained in your spatial object, type: View(MyPoints@data).

See Also

create_Lines, create_Polys, create_PolyGrids, create_Stations, add_RefGrid.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#Example 1: Simple points with labels

MyPoints=create_Points(Input=PointData)
plot(MyPoints)
text(MyPoints$x,MyPoints$y,MyPoints$name,adj=c(0.5,-0.5),xpd=TRUE)

#Example 2: Simple points with labels, highlighting one group of points with the same name

MyPoints=create_Points(Input=PointData)
plot(MyPoints)
text(MyPoints$x,MyPoints$y,MyPoints$name,adj=c(0.5,-0.5),xpd=TRUE)
plot(MyPoints[MyPoints$name=='four',],bg='red',pch=21,cex=1.5,add=TRUE)

#Example 3: Buffered points with radius proportional to catch

MyPoints=create_Points(Input=PointData,Buffer=0.5*PointData$Catch)
plot(MyPoints,col='green')
text(MyPoints$x,MyPoints$y,MyPoints$name,adj=c(0.5,0.5),xpd=TRUE)

#Example 4: Buffered points with radius proportional to catch and clipped to the Coast

MyPoints=create_Points(Input=PointData,Buffer=2*PointData$Catch,Clip=TRUE)
plot(MyPoints,col='cyan')
plot(Coast[Coast$ID=='All',],add=TRUE,col='grey')

CCAMLRGIS documentation built on Sept. 8, 2021, 9:09 a.m.