This R code (YKDsalinity_QC.R) is used to process the raw legacy salinity data for fixed and random plots (2006 - 2019) and produce the quality controlled legacy salinity data for analysis and sharing (YKDsalinity_QC.csv). Basic operations include transforming missing value to a common code, transforming other variables to match the data dictionary, and cleaning spatial location issues. Of special note is that this QC process discover significant error in location data due to a variety of reasons so the random plot centers are added to the data table and should be used for analysis. The code requires the raw data (“Official_YKD.SALINITY.DATA.MASTER.2020.csv”), a definition of the nest plot study area (“NestPlotStudyAreaBoundary.geojson”), and the location of the random plot centers (“Plot_Location_Size_Strata_Search_1985-2019.csv”). The code writes the QC salinity data file “YKDsalinity_QC.csv”.