##Install iNEXT
iNEXT and ggplot2 must be installed within your RStudio to properly use this script. If you have not installed the package, paste the below command into your R console.
install.packages(“iNEXT”)
install.packages(“ggplot2”)
iNEXT Package
iNEXT (iNterpolation and EXTrapolation) is an R package used for rarefaction and extrapolation of species diversity (Hill numbers). Detailed information about all functions in iNEXT is provided in the iNEXT Manual in CRAN and also in iNEXT User Guide (https://github.com/JohnsonHsieh/iNEXT).
iNEXT focuses on three measures of Hill numbers of order q: species richness (q=0), Shannon diversity (q=1, the exponential of Shannon entropy) and Simpson diversity (q=2, the inverse of Simpson concentration). For each diversity measure, iNEXT uses the observed sample of abundance or incidence data (called the “reference sample”) to compute diversity estimates for rarefied and extrapolated samples and the associated 95% (default) confidence intervals as well as plot the following two types of rarefaction and extrapolation (R/E) curves:
Sample-size-based R/E sampling curves: iNEXT computes diversity estimates for rarefied and extrapolated samples up to double the reference sample size (by default) or a user-specified size. This type of sampling curve plots the diversity estimates with respect to sample size. Sample size refers to the number of individuals in a sample for abundance data, whereas it refers to the number of sampling units for incidence data.
Coverage-based R/E sampling curves: iNEXT computes diversity estimates for rarefied and extrapolated samples with sample completeness (as measured by sample coverage) up to the coverage value of double the reference sample size (by default) or a user-specified coverage. This type of sampling curve plots the diversity estimates with respect to sample coverage. In addition to the above two types of sampling curves, iNEXT also plots a sample completeness curve, which depicts how the sample coverage estimate varies as a function of sample size. The sample completeness curve can be thought of as a bridge connecting the afore-mentioned two types of curves.
Preparing your data
The mussel abundance data should be arranged in a csv file so that species are listed as the columns and each search cell or transects is listed as the rows:

Note that the search units should be the same across a dataset, in other words, you should not include search cells and transects within the same analysis as those are different search methods.
Once you have arranged the file correctly, save your file as “MusselAbundanceData.csv”
Before running the below scripts
1) set your working directory within R to the location of where the “MusselAbundanceData.csv” file is located,
2) Place the iNEXT.qmd file within the same directory with the “MusselAbundanceData.csv”
Abundance based richness estimates
The below script will provide a species accumulation curve from abundance data.
The solid line displays the number of observed species based on the number of individuals recovered in the current survey, while the dashed line displays the extrapolated estimate of the number of species that may have been found if more individuals were recovered.
AsyEst: Provides information on the number of species observed and the estimated number of species within the area.
iNextEst Provides the observed number of species (qD) based on the number of individuals (m), along with an extrapolated estimate for the number of species that could have been found if more individuals were recovered. This gives you an idea of how much more effort (in terms of searched individuals) would be required to find additional species.
Observed Estimator Est_s.e. 95% Lower 95% Upper
Species Richness 41.000 43.665 3.484 41.377 59.854
Shannon diversity 18.324 18.546 0.436 18.324 19.402
Simpson diversity 12.287 12.362 0.383 12.287 13.112
m method order qD qD.LCL qD.UCL SC SC.LCL SC.UCL
1 1 interpolated 0 1.000 1.000 1.000 0.081 0.076 0.086
2 104 interpolated 0 24.211 23.262 25.160 0.925 0.919 0.930
3 208 interpolated 0 29.221 27.999 30.443 0.969 0.965 0.973
4 311 interpolated 0 31.681 30.260 33.102 0.981 0.978 0.985
5 415 interpolated 0 33.321 31.709 34.932 0.987 0.984 0.989
6 518 interpolated 0 34.549 32.763 36.335 0.989 0.987 0.992
7 622 interpolated 0 35.553 33.608 37.498 0.991 0.989 0.993
8 725 interpolated 0 36.387 34.300 38.473 0.993 0.991 0.994
9 829 interpolated 0 37.108 34.893 39.324 0.994 0.992 0.995
10 932 interpolated 0 37.730 35.395 40.065 0.994 0.993 0.996
11 1036 interpolated 0 38.281 35.832 40.730 0.995 0.993 0.997
12 1139 interpolated 0 38.764 36.205 41.322 0.996 0.994 0.997
13 1243 interpolated 0 39.196 36.529 41.863 0.996 0.994 0.998
14 1346 interpolated 0 39.578 36.803 42.353 0.996 0.995 0.998
15 1450 interpolated 0 39.924 37.039 42.809 0.997 0.995 0.999
16 1553 interpolated 0 40.232 37.236 43.227 0.997 0.995 0.999
17 1657 interpolated 0 40.512 37.402 43.622 0.997 0.996 0.999
18 1760 interpolated 0 40.765 37.539 43.990 0.998 0.996 1.000
19 1864 interpolated 0 40.998 37.653 44.343 0.998 0.996 1.000
20 1865 observed 0 41.000 37.654 44.346 0.998 0.996 1.000
21 1866 extrapolated 0 41.002 37.655 44.349 0.998 0.996 1.000
22 1964 extrapolated 0 41.204 37.742 44.666 0.998 0.996 1.000
23 2062 extrapolated 0 41.391 37.812 44.969 0.998 0.996 1.000
24 2160 extrapolated 0 41.563 37.866 45.260 0.998 0.996 1.000
25 2258 extrapolated 0 41.722 37.904 45.540 0.998 0.996 1.000
26 2356 extrapolated 0 41.870 37.929 45.810 0.999 0.997 1.000
27 2454 extrapolated 0 42.006 37.942 46.070 0.999 0.997 1.001
28 2552 extrapolated 0 42.132 37.943 46.320 0.999 0.997 1.001
29 2650 extrapolated 0 42.248 37.933 46.563 0.999 0.997 1.001
30 2748 extrapolated 0 42.355 37.913 46.797 0.999 0.997 1.001
31 2847 extrapolated 0 42.456 37.885 47.026 0.999 0.997 1.001
32 2945 extrapolated 0 42.547 37.849 47.246 0.999 0.997 1.001
33 3043 extrapolated 0 42.632 37.806 47.458 0.999 0.997 1.001
34 3141 extrapolated 0 42.710 37.756 47.665 0.999 0.997 1.001
35 3239 extrapolated 0 42.783 37.701 47.865 0.999 0.998 1.001
36 3337 extrapolated 0 42.850 37.640 48.059 0.999 0.998 1.001
37 3435 extrapolated 0 42.911 37.575 48.248 0.999 0.998 1.001
38 3533 extrapolated 0 42.969 37.506 48.431 0.999 0.998 1.001
39 3631 extrapolated 0 43.021 37.433 48.610 0.999 0.998 1.001
40 3730 extrapolated 0 43.071 37.357 48.785 1.000 0.998 1.001
Incidence based richness estimates
The below script will provide a species accumulation curve from incidence data (presence / absence).
The solid line displays the number of observed species based on the number of search units (search cells, transects, quadrats, etc.) used in the current survey, while the dashed line displays the extrapolated estimate of the number of species that may have been found with more search effort (increasing number of search units).
AsyEst: Provides information on the number of species observed and the estimated number of species within the area.
iNextEst Provides the observed number of species (qD) based on the number of search units (m), along with an extrapolated estimate for the number of species that could have been found with more search effort (increasing number of search units). This gives you an idea of how much more effort (in terms of search units) would be required to find additional species.
Observed Estimator Est_s.e. 95% Lower 95% Upper
Species Richness 41.000 46.833 5.812 42.146 70.700
Shannon diversity 32.569 35.588 1.682 32.569 38.884
Simpson diversity 28.078 30.466 1.491 28.078 33.389
t method order qD qD.LCL qD.UCL SC SC.LCL SC.UCL
1 1 interpolated 0 10.714 9.664 11.765 0.351 0.316 0.386
2 2 interpolated 0 17.671 16.120 19.223 0.552 0.511 0.593
3 3 interpolated 0 22.471 20.668 24.275 0.675 0.633 0.716
4 4 interpolated 0 25.958 24.026 27.890 0.754 0.715 0.794
5 5 interpolated 0 28.592 26.586 30.598 0.809 0.772 0.846
6 6 interpolated 0 30.639 28.575 32.702 0.848 0.813 0.883
7 7 interpolated 0 32.265 30.143 34.386 0.877 0.844 0.910
8 8 interpolated 0 33.580 31.392 35.768 0.899 0.868 0.929
9 9 interpolated 0 34.664 32.399 36.929 0.915 0.887 0.944
10 10 interpolated 0 35.573 33.221 37.925 0.927 0.901 0.954
11 11 interpolated 0 36.350 33.903 38.796 0.937 0.911 0.962
12 12 interpolated 0 37.027 34.479 39.574 0.944 0.920 0.968
13 13 interpolated 0 37.627 34.974 40.280 0.950 0.927 0.972
14 14 interpolated 0 38.168 35.407 40.928 0.954 0.932 0.976
15 15 interpolated 0 38.662 35.792 41.532 0.957 0.936 0.979
16 16 interpolated 0 39.118 36.138 42.099 0.960 0.940 0.981
17 17 interpolated 0 39.543 36.452 42.634 0.963 0.943 0.983
18 18 interpolated 0 39.941 36.740 43.142 0.965 0.946 0.984
19 20 interpolated 0 40.667 37.245 44.088 0.969 0.951 0.987
20 21 observed 0 41.000 37.468 44.532 0.971 0.953 0.989
21 22 extrapolated 0 41.315 37.673 44.958 0.972 0.954 0.990
22 23 extrapolated 0 41.614 37.860 45.367 0.974 0.956 0.991
23 24 extrapolated 0 41.896 38.032 45.759 0.975 0.958 0.992
24 25 extrapolated 0 42.163 38.189 46.137 0.976 0.960 0.993
25 26 extrapolated 0 42.415 38.331 46.499 0.978 0.961 0.994
26 27 extrapolated 0 42.654 38.460 46.847 0.979 0.963 0.995
27 28 extrapolated 0 42.880 38.577 47.182 0.980 0.964 0.996
28 29 extrapolated 0 43.094 38.683 47.504 0.981 0.966 0.997
29 30 extrapolated 0 43.296 38.778 47.814 0.982 0.967 0.997
30 31 extrapolated 0 43.487 38.863 48.111 0.983 0.968 0.998
31 32 extrapolated 0 43.668 38.939 48.397 0.984 0.969 0.999
32 33 extrapolated 0 43.839 39.006 48.672 0.985 0.971 0.999
33 34 extrapolated 0 44.001 39.066 48.936 0.986 0.972 1.000
34 35 extrapolated 0 44.154 39.118 49.189 0.986 0.973 1.000
35 36 extrapolated 0 44.299 39.164 49.433 0.987 0.974 1.000
36 37 extrapolated 0 44.436 39.204 49.667 0.988 0.975 1.000
37 38 extrapolated 0 44.565 39.238 49.893 0.989 0.976 1.000
38 39 extrapolated 0 44.688 39.267 50.109 0.989 0.977 1.000
39 40 extrapolated 0 44.804 39.291 50.317 0.990 0.978 1.000
40 42 extrapolated 0 45.017 39.326 50.709 0.991 0.979 1.000