span8
span4
span8
span4
Intro: Getting Started with the RCaller|Previous: RCaller: Ins and outs of using R in FME|Next: RCaller: Interpolate Points to Raster Through Kriging
TheRCallerallows users to run R scripts in FME.In this demo,we would like to determine whether or not there is a correlation between the height of trees and the diameter of trees.
correlation-tree-heigh-diameter.fmwt
The CSV file,PublicTrees.csv,contains various attributes regarding trees in a city.
Source CSV data viewed with Data Inspector
The downloadCorrelation_Tree_Height_Diameter.fmwtis the complete workspace.If you would like to create the workspace yourself,please downloadPublicTrees.csv,and follow the steps below to create it.
1.Read Source Data
Read the PublicTrees.csv using a CSV Reader.
2.Add a RCaller
For the RScript,please specify the following:
Correlation=cor(CSV$Diameter,CSV$Height,method = "pearson")fmeOutput<-data.frame(Correlation)
The cor() function will calculate the correlation between tree height and tree diameter.If desirable to work with the attribute created during the R Script,in this case Correlation,it is necessary to expose it in the Attributes to Expose parameter,or in an AttributeExposer transformer following the RCaller.
Please expose the attribute Correlation in the Attributes to Expose parameter.
RCaller parameters
3.Examine the result
Add a logger after the RCaller and run the workspace.In the log file,the Correlation is reported as 0.48002325189223527.This value indicates a moderate relationship between tree height and tree diameter.A value closer to 1 or -1 would indicate stronger correlation between height and diameter.Tree genus or species may be a factor to consider,and it is possible to filter based on either.This may indicate that some tree genus or species has a stronger correlation between tree height and tree diameter.
Logged RCaller output
Continue to RCaller: Interpolate Points to Raster Through Kriging
Tutorial: Getting Started with the RCaller
How To Use Parallel Processing in FME
RCaller: Ins and outs of using R in FME
Calculating a Running Total or Cumulative Sum | StatisticsCalculator
RCaller: Interpolate Points to Raster Through Kriging
Using LIDAR Waveform Attributes in FME
© 2019 亚搏在线Safe Software Inc |Legal