#!/usr/bin/env Rscript # Attach packages to workspace, execute with every new session source("ReadOpus.R") # Determine file path path <- paste0(getwd(), "/OPUS/") 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, 5) # Replace last "." with "_", add ".DPT" file_name <- paste0(sub(".([^.]*)$", "_\\1", file_name), ".DPT") # Determine target, where the result should appear target_path <- paste0(path, "../DPT/", file_name) # Create file file.create(target_path) # Fill file with dataframe write.table(data, target_path, row.names = FALSE, col.names = FALSE, sep = ",") # Call python script system(paste('python3 transferData.py', file_name))