Learn R Programming

geozoning (version 1.0.0)

datanormX: normalize data coords with same ratio (for non square field)

Description

normalize data coords with same ratio (for non square field)

Usage

datanormX(data, bd)

Arguments

data

frame with x and y components

bd

list with x and y components

Value

a list with components

dataN

normalized data

boundaryN

normalized boundary

ratio

normalizing ratio

xmin

minimum value of x within boundary

xmax

maximum value of x within boundary

ymin

minimum value of y within boundary

ymax

maximum value of y within boundary

Details

normalize x between 0 and 1, y and boundary with same ratio

Examples

Run this code
# NOT RUN {
x=runif(100, min=0, max=1)
y=runif(100, min=0.2, max=1.7)
range(x) # not [0,1]
tabData=data.frame(x=x,y=y)
bd=list(x=c(0,0,1,1,0), y=c(0.2,1.7,1.7,0.2,0.2))
res=datanormX(tabData,bd)
apply(res$dataN,2,range)# x range is now [0,1], not y range
res$ratio # normalization ratio
# }

Run the code above in your browser using DataLab