Variable number of decimal places
This commit is contained in:
parent
d32bacf3e5
commit
e4dbdfb170
File diff suppressed because it is too large
Load Diff
@ -9,7 +9,7 @@ file_name <- commandArgs(trailingOnly = TRUE)[1]
|
||||
file_path <- paste(path, file_name, sep = "")
|
||||
|
||||
# Convert opus binary file into dataframe
|
||||
data <- read_opus_univ(file_path)
|
||||
data <- read_opus_univ(file_path, 5)
|
||||
|
||||
# Set working directory to path where the result file should appear
|
||||
setwd(paste(path, "../DPT", sep = ""))
|
||||
|
@ -1,6 +1,6 @@
|
||||
#Code adapted from github.com/philipp-baumann/simplerspec
|
||||
|
||||
read_opus_univ <- function(file_path){
|
||||
read_opus_univ <- function(file_path, limit){
|
||||
|
||||
`%do%` <- foreach::`%do%`
|
||||
extract <- 'spc'
|
||||
@ -13,7 +13,6 @@ read_opus_univ <- function(file_path){
|
||||
|
||||
try({
|
||||
|
||||
# file_path <- "data/soilspec_background/yamsys_bg_gold/BF_lo_15_soil_cal.0"
|
||||
# Read entire content of file as bytes
|
||||
pa <- hexView::readRaw(file_path, offset = 0,
|
||||
nbytes = file.info(file_path)$size, human = "char",
|
||||
@ -409,8 +408,9 @@ read_opus_univ <- function(file_path){
|
||||
}
|
||||
|
||||
## Allocate and return data from spectra in output list (out) ==============
|
||||
out <- data.frame(wavenumbers[["spc"]], spc[['spc']], row.names = NULL)
|
||||
out <- data.frame(round(wavenumbers[['spc']], limit), round(spc[['spc']], limit), row.names = NULL)
|
||||
# Return spectra data and metadata contained as elements in list out
|
||||
out
|
||||
}) # closes try() function
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user