Learn R Programming

ArchaeoPhases (version 1.4.5)

ImportCSV: Importing a CSV file containing the output of the MCMC algorithm

Description

Use of the read.csv with the default values for CSV files extracted from ChronoModel software. For MCMC in a date format different from BC/AD, use the parameter referenceYear to convert the MCMC in BC/AD otherwise, the remaining functions of this package will not work. MCMC files generated by BCAl may contain an empty last row. This row should be withdrawn using the 'rowToWithdraw' parameter. Otherwise, the functions of the package 'ArchaeoPhases' will not work properly.

Usage

ImportCSV(file, dec = '.', sep=',', comment.char='#', header = TRUE, 
  iterationColumn = NULL, referenceYear = NULL, rowToWithdraw=NULL, bin.width=NULL)

Arguments

file

the name of the CSV file containing the output of the MCMC algorithm

dec

the character used in the file for decimal points for the use of read.csv()

sep

the field separator character for the use of read.csv()

comment.char

a character vector of length one containing a single character or an empty string for the use of read.csv()

header

a logical value indicating whether the file contains the names of the variables as its first line.

iterationColumn

number of the column corresponding to the iteration values. Default = 1.

referenceYear

the year of reference for MCMC in date format other than BC/AD. Default value = NULL as ChronoModel and Oxacl export the MCMC samples in BC/AD format.

rowToWithdraw

the number of the row to be withdrawn, or "last" for the last row of the data frame. Default = NULL.

bin.width

the bin width specified in a BCal project. Note that bin.width does not have to be set if the BCal default bin width of 1 is used.

Value

Returns a dataframe containing a representation of the data in the file. MCMC should now be in date format BC/AD.

Examples

Run this code
# NOT RUN {
  data(Events)
 # write.csv(Events, "data.csv", row.names=FALSE)
 #  data = ImportCSV("data.csv", dec = '.', sep=',', comment.char='#', header = TRUE,
 #  iterationColumn = 1)
  
  # Import of MCMC generated by BCal and extracted in cal BP (the year of reference is 1950)
  data(Fishpond)
 # write.csv(Fishpond, "fishpond_MCMC.csv", row.names=FALSE)
 #  Fishpond = ImportCSV("fishpond_MCMC.csv", dec = '.', sep=',', header = TRUE, 
 #  iterationColum= 1, referenceYear = 1950, rowToWithdraw = "last")
# }

Run the code above in your browser using DataLab