28 lines
718 B
R
28 lines
718 B
R
#!/usr/bin/env Rscript
|
|
|
|
# Attach package to workspace, execute with every new session
|
|
source("ReadOpus.R")
|
|
|
|
# Determine file path
|
|
path <- paste(getwd(), "/OPUS/", sep = "")
|
|
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)
|
|
|
|
# Set working directory to path where the result file should appear
|
|
setwd(paste(path, "../DPT", sep = ""))
|
|
|
|
# Replace last "." with "_", add ".DPT" and create file
|
|
file_name <- paste(sub(".([^.]*)$", "_\\1", file_name), ".DPT", sep = "")
|
|
file.create(file_name)
|
|
|
|
# Fill file with dataframe
|
|
write.table(data, file_name, row.names = FALSE, col.names = FALSE, sep = ",")
|
|
|
|
|
|
|
|
|
|
|