The following  "NI_calculation_example" directory contains all the R-functions and commands to carry out a Nature Index analysis.
Data provided here as an example are the data collected for the major habitat "mountain" in the Nature Index for Norway 2010.
Most of the files are used in internal functions.
The most important data files are:

1- "mountain_data.txt" contains the raw data we collected for mountains areas.
2- "Indicatorlist_mountain.txt" is a subset of the indicator list that contains all the information for indicator related to mountains
3- "Area.txt" contains area information for each municipality (municipality area, terrestrial area, marine area, geographic location of municipality, area of major habitats)
These 3 files are related to each other. Their structure might be used as a template for any implementation of the Nature Index.

To operate Nature index calculation, the command lines can be found in the following file:
"NI_Commands.R". It can be opened with any command line editor, or with notepad. It contains all the command lines to calculate Nature Index maps, trends, etc.
It relies on the file "NI_function.R" that contains all the R-function built for NI calculation (function for stat fitting, weights definition, mapping etc.), together with explanations on how to specify some arguments.
To start quickly, on a Windows system, just copy/paste your R shortcut in the NI_calculation_example directory. Then right click on the shortcut, "properties", "General" tab, copy the path describing the "Location" of the shortcut, then go to the "Shortcut" tab and paste the path in "Start in".
Be sure that you’re using R 2.11.1 version (the codes might not run properly with older versions). Be sure that you have the following packages:
fields, gamlss,gamlss.dist, gpclib, gstat, maptools, msm, splancs, truncnorm
Then open R by using your shortcut, and use the following command: source(file="NI_commands.R")

All the functions in the file "NI_commands.R" will be automatically executed. This will result in the production of several results files and figures. The execution of all the  commands takes ~15 minutes on my 4GO RAM PC, with 64-bits version of R2.11.1 (2010-05-31).

For any questions regarding the code:
Gregoire.Certain@imr.no, or gregoirecertain@hotmail.com
I will not answer questions regarding basic R usage though (please see the R web site www.r-project.org).
