fill dummy file with data
This commit is contained in:
parent
3c0c540044
commit
7018a248e7
24
OpusData.R
24
OpusData.R
@ -1,7 +1,12 @@
|
||||
#!/usr/bin/env Rscript
|
||||
|
||||
# Package installation, execute once
|
||||
#if (!require("remotes")) install.packages("remotes")
|
||||
#remotes::install_github("philipp-baumann/simplerspec")
|
||||
source('D:/OpusData/OpusData.R')
|
||||
|
||||
# Attach package to workspace, execute with every new session
|
||||
library("simplerspec")
|
||||
|
||||
file_path <- "D:\\OpusData\\Spektrometer Anbindung\\Test Daten\\OPUS\\"
|
||||
file_name <- "Rng02_Rng2630_01.0"
|
||||
|
||||
@ -9,11 +14,22 @@ data <- read_opus_univ(paste(file_path, file_name, sep = ""), extract = "spc",
|
||||
atm_comp_minus4offset = FALSE)
|
||||
|
||||
data_x_values <- data$`D:\\OpusData\\Spektrometer Anbindung\\Test Daten\\OPUS\\Rng02_Rng2630_01.0`$wavenumbers
|
||||
data_y_values <- data$`D:\\OpusData\\Spektrometer Anbindung\\Test Daten\\OPUS\\Rng02_Rng2630_01.0`$spc
|
||||
data_y_values <- as.numeric(data$`D:\\OpusData\\Spektrometer Anbindung\\Test Daten\\OPUS\\Rng02_Rng2630_01.0`$spc[1,])
|
||||
|
||||
|
||||
print(data_x_values)
|
||||
# Set working directory to path where the result should appear
|
||||
setwd(paste(file_path, "..\\DPT", sep = ""))
|
||||
file.create(paste(substr(file_name, 0, nchar(file_name)-1), "DPT", sep = ""))
|
||||
|
||||
|
||||
# Replace last "." with "_", add ".DPT" and create file
|
||||
file_name <- paste(sub(".([^.]*)$", "_\\1", file_name), ".DPT", sep = "")
|
||||
file.create(file_name)
|
||||
|
||||
# Convert data into dataframe
|
||||
data <- data.frame(data_x_values, data_y_values, row.names = NULL)
|
||||
|
||||
# Fill file with dataframe
|
||||
write.table(data, file_name, row.names = FALSE, col.names = FALSE, sep=",")
|
||||
|
||||
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user