Make data path and file name variable
This commit is contained in:
		
							
								
								
									
										5
									
								
								.Rproj.user/9E972B4F/pcs/debug-breakpoints.pper
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								.Rproj.user/9E972B4F/pcs/debug-breakpoints.pper
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,5 @@
 | 
				
			|||||||
 | 
					{
 | 
				
			||||||
 | 
					    "debugBreakpointsState": {
 | 
				
			||||||
 | 
					        "breakpoints": []
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										9
									
								
								.Rproj.user/9E972B4F/pcs/files-pane.pper
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								.Rproj.user/9E972B4F/pcs/files-pane.pper
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,9 @@
 | 
				
			|||||||
 | 
					{
 | 
				
			||||||
 | 
					    "sortOrder": [
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            "columnIndex": 2,
 | 
				
			||||||
 | 
					            "ascending": true
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    ],
 | 
				
			||||||
 | 
					    "path": "D://OpusData"
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										3
									
								
								.Rproj.user/9E972B4F/pcs/source-pane.pper
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										3
									
								
								.Rproj.user/9E972B4F/pcs/source-pane.pper
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,3 @@
 | 
				
			|||||||
 | 
					{
 | 
				
			||||||
 | 
					    "activeTab": 0
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										14
									
								
								.Rproj.user/9E972B4F/pcs/windowlayoutstate.pper
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										14
									
								
								.Rproj.user/9E972B4F/pcs/windowlayoutstate.pper
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,14 @@
 | 
				
			|||||||
 | 
					{
 | 
				
			||||||
 | 
					    "left": {
 | 
				
			||||||
 | 
					        "splitterpos": 317,
 | 
				
			||||||
 | 
					        "topwindowstate": "NORMAL",
 | 
				
			||||||
 | 
					        "panelheight": 790,
 | 
				
			||||||
 | 
					        "windowheight": 828
 | 
				
			||||||
 | 
					    },
 | 
				
			||||||
 | 
					    "right": {
 | 
				
			||||||
 | 
					        "splitterpos": 513,
 | 
				
			||||||
 | 
					        "topwindowstate": "NORMAL",
 | 
				
			||||||
 | 
					        "panelheight": 790,
 | 
				
			||||||
 | 
					        "windowheight": 828
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										5
									
								
								.Rproj.user/9E972B4F/pcs/workbench-pane.pper
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								.Rproj.user/9E972B4F/pcs/workbench-pane.pper
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,5 @@
 | 
				
			|||||||
 | 
					{
 | 
				
			||||||
 | 
					    "TabSet1": 0,
 | 
				
			||||||
 | 
					    "TabSet2": 3,
 | 
				
			||||||
 | 
					    "TabZoom": {}
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										8
									
								
								.Rproj.user/9E972B4F/persistent-state
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								.Rproj.user/9E972B4F/persistent-state
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,8 @@
 | 
				
			|||||||
 | 
					build-last-errors="[]"
 | 
				
			||||||
 | 
					build-last-errors-base-dir=""
 | 
				
			||||||
 | 
					build-last-outputs="[]"
 | 
				
			||||||
 | 
					compile_pdf_state="{\"tab_visible\":false,\"running\":false,\"target_file\":\"\",\"output\":\"\",\"errors\":[]}"
 | 
				
			||||||
 | 
					files.monitored-path=""
 | 
				
			||||||
 | 
					find-in-files-state="{\"handle\":\"\",\"input\":\"\",\"path\":\"\",\"regex\":false,\"ignoreCase\":false,\"results\":{\"file\":[],\"line\":[],\"lineValue\":[],\"matchOn\":[],\"matchOff\":[],\"replaceMatchOn\":[],\"replaceMatchOff\":[]},\"running\":false,\"replace\":false,\"preview\":false,\"gitFlag\":false,\"replacePattern\":\"\"}"
 | 
				
			||||||
 | 
					imageDirtyState="1"
 | 
				
			||||||
 | 
					saveActionState="-1"
 | 
				
			||||||
							
								
								
									
										5
									
								
								.Rproj.user/9E972B4F/rmd-outputs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								.Rproj.user/9E972B4F/rmd-outputs
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,5 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
							
								
								
									
										1
									
								
								.Rproj.user/9E972B4F/saved_source_markers
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								.Rproj.user/9E972B4F/saved_source_markers
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1 @@
 | 
				
			|||||||
 | 
					{"active_set":"","sets":[]}
 | 
				
			||||||
							
								
								
									
										25
									
								
								.Rproj.user/9E972B4F/sources/per/t/9E617014
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										25
									
								
								.Rproj.user/9E972B4F/sources/per/t/9E617014
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,25 @@
 | 
				
			|||||||
 | 
					{
 | 
				
			||||||
 | 
					    "id": "9E617014",
 | 
				
			||||||
 | 
					    "path": "D:/OpusData/OpusData.R",
 | 
				
			||||||
 | 
					    "project_path": "OpusData.R",
 | 
				
			||||||
 | 
					    "type": "r_source",
 | 
				
			||||||
 | 
					    "hash": "1542888404",
 | 
				
			||||||
 | 
					    "contents": "",
 | 
				
			||||||
 | 
					    "dirty": false,
 | 
				
			||||||
 | 
					    "created": 1611062270843.0,
 | 
				
			||||||
 | 
					    "source_on_save": false,
 | 
				
			||||||
 | 
					    "relative_order": 1,
 | 
				
			||||||
 | 
					    "properties": {
 | 
				
			||||||
 | 
					        "tempName": "Untitled1",
 | 
				
			||||||
 | 
					        "cursorPosition": "19,0",
 | 
				
			||||||
 | 
					        "scrollLine": "0"
 | 
				
			||||||
 | 
					    },
 | 
				
			||||||
 | 
					    "folds": "",
 | 
				
			||||||
 | 
					    "lastKnownWriteTime": 1611062469,
 | 
				
			||||||
 | 
					    "encoding": "UTF-8",
 | 
				
			||||||
 | 
					    "collab_server": "",
 | 
				
			||||||
 | 
					    "source_window": "",
 | 
				
			||||||
 | 
					    "last_content_update": 1611062469561,
 | 
				
			||||||
 | 
					    "read_only": false,
 | 
				
			||||||
 | 
					    "read_only_alternatives": []
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										37
									
								
								.Rproj.user/9E972B4F/sources/per/t/9E617014-contents
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										37
									
								
								.Rproj.user/9E972B4F/sources/per/t/9E617014-contents
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,37 @@
 | 
				
			|||||||
 | 
					#!/usr/bin/env Rscript
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Package installation, execute once
 | 
				
			||||||
 | 
					#if (!require("remotes")) install.packages("remotes")
 | 
				
			||||||
 | 
					#remotes::install_github("philipp-baumann/simplerspec")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Attach package to workspace, execute with every new session
 | 
				
			||||||
 | 
					library("simplerspec")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Determine file path
 | 
				
			||||||
 | 
					path <- paste(getwd(), "\\OPUS\\", sep = "")
 | 
				
			||||||
 | 
					file_name <- "Rng02_Rng2630_01.0"
 | 
				
			||||||
 | 
					file_path <- paste(path, file_name, sep = "")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Convert opus binary file into extractable data
 | 
				
			||||||
 | 
					data <- read_opus_univ(file_path, extract = "spc",atm_comp_minus4offset = FALSE)
 | 
				
			||||||
 | 
					# Extract data
 | 
				
			||||||
 | 
					data_x_values <- data[[file_path]]$wavenumbers
 | 
				
			||||||
 | 
					data_y_values <- as.numeric(data[[file_path]]$spc[1,])
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Set working directory to path where the result file should appear
 | 
				
			||||||
 | 
					setwd(paste(path, "..\\DPT", sep = ""))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Convert data into dataframe
 | 
				
			||||||
 | 
					data <- data.frame(data_x_values, data_y_values, row.names = NULL)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# 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=",")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
							
								
								
									
										5
									
								
								.Rproj.user/9E972B4F/sources/prop/D7FA7239
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								.Rproj.user/9E972B4F/sources/prop/D7FA7239
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,5 @@
 | 
				
			|||||||
 | 
					{
 | 
				
			||||||
 | 
					    "tempName": "Untitled1",
 | 
				
			||||||
 | 
					    "cursorPosition": "17,0",
 | 
				
			||||||
 | 
					    "scrollLine": "4"
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										5
									
								
								.Rproj.user/9E972B4F/sources/prop/EBB7FAC6
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								.Rproj.user/9E972B4F/sources/prop/EBB7FAC6
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,5 @@
 | 
				
			|||||||
 | 
					{
 | 
				
			||||||
 | 
					    "tempName": "Untitled1",
 | 
				
			||||||
 | 
					    "cursorPosition": "19,0",
 | 
				
			||||||
 | 
					    "scrollLine": "0"
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										2
									
								
								.Rproj.user/9E972B4F/sources/prop/INDEX
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										2
									
								
								.Rproj.user/9E972B4F/sources/prop/INDEX
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,2 @@
 | 
				
			|||||||
 | 
					D%3A%2F%2FOpusData%2FOpusData.R="D7FA7239"
 | 
				
			||||||
 | 
					D%3A%2FOpusData%2FOpusData.R="EBB7FAC6"
 | 
				
			||||||
							
								
								
									
										0
									
								
								.Rproj.user/shared/notebooks/patch-chunk-names
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										0
									
								
								.Rproj.user/shared/notebooks/patch-chunk-names
									
									
									
									
									
										Normal file
									
								
							
							
								
								
									
										1
									
								
								.Rproj.user/shared/notebooks/paths
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								.Rproj.user/shared/notebooks/paths
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1 @@
 | 
				
			|||||||
 | 
					D:/OpusData/OpusData.R="5F466D5B"
 | 
				
			||||||
							
								
								
									
										4
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										4
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							@@ -1,4 +0,0 @@
 | 
				
			|||||||
.Rproj.user
 | 
					 | 
				
			||||||
.Rhistory
 | 
					 | 
				
			||||||
.RData
 | 
					 | 
				
			||||||
.Ruserdata
 | 
					 | 
				
			||||||
							
								
								
									
										26
									
								
								OpusData.R
									
									
									
									
									
								
							
							
						
						
									
										26
									
								
								OpusData.R
									
									
									
									
									
								
							@@ -7,29 +7,31 @@
 | 
				
			|||||||
# Attach package to workspace, execute with every new session
 | 
					# Attach package to workspace, execute with every new session
 | 
				
			||||||
library("simplerspec")
 | 
					library("simplerspec")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
file_path <- "D:\\OpusData\\Spektrometer Anbindung\\Test Daten\\OPUS\\"
 | 
					# Determine file path
 | 
				
			||||||
 | 
					path <- paste(getwd(), "\\OPUS\\", sep = "")
 | 
				
			||||||
file_name <- "Rng02_Rng2630_01.0"
 | 
					file_name <- "Rng02_Rng2630_01.0"
 | 
				
			||||||
 | 
					file_path <- paste(path, file_name, sep = "")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
data <- read_opus_univ(paste(file_path, file_name, sep = ""), extract = "spc",
 | 
					# Convert opus binary file into extractable data
 | 
				
			||||||
                   atm_comp_minus4offset = FALSE)
 | 
					data <- read_opus_univ(file_path, extract = "spc",atm_comp_minus4offset = FALSE)
 | 
				
			||||||
 | 
					# Extract data
 | 
				
			||||||
 | 
					data_x_values <- data[[file_path]]$wavenumbers
 | 
				
			||||||
 | 
					data_y_values <- as.numeric(data[[file_path]]$spc[1,])
 | 
				
			||||||
 | 
					
 | 
				
			||||||
data_x_values <- data$`D:\\OpusData\\Spektrometer Anbindung\\Test Daten\\OPUS\\Rng02_Rng2630_01.0`$wavenumbers
 | 
					# Set working directory to path where the result file should appear
 | 
				
			||||||
data_y_values <- as.numeric(data$`D:\\OpusData\\Spektrometer Anbindung\\Test Daten\\OPUS\\Rng02_Rng2630_01.0`$spc[1,])
 | 
					setwd(paste(path, "..\\DPT", sep = ""))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Convert data into dataframe
 | 
				
			||||||
print(data_x_values)
 | 
					data <- data.frame(data_x_values, data_y_values, row.names = NULL)
 | 
				
			||||||
# Set working directory to path where the result should appear
 | 
					 | 
				
			||||||
setwd(paste(file_path, "..\\DPT", sep = ""))
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Replace last "." with "_", add ".DPT" and create file
 | 
					# Replace last "." with "_", add ".DPT" and create file
 | 
				
			||||||
file_name <- paste(sub(".([^.]*)$", "_\\1", file_name), ".DPT", sep = "")
 | 
					file_name <- paste(sub(".([^.]*)$", "_\\1", file_name), ".DPT", sep = "")
 | 
				
			||||||
file.create(file_name)
 | 
					file.create(file_name)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Convert data into dataframe
 | 
					 | 
				
			||||||
data <- data.frame(data_x_values, data_y_values, row.names = NULL)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
# Fill file with dataframe
 | 
					# Fill file with dataframe
 | 
				
			||||||
write.table(data, file_name, row.names = FALSE, col.names = FALSE, sep=",")
 | 
					write.table(data, file_name, row.names = FALSE, col.names = FALSE, sep=",")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,13 +0,0 @@
 | 
				
			|||||||
Version: 1.0
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
RestoreWorkspace: Default
 | 
					 | 
				
			||||||
SaveWorkspace: Default
 | 
					 | 
				
			||||||
AlwaysSaveHistory: Default
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
EnableCodeIndexing: Yes
 | 
					 | 
				
			||||||
UseSpacesForTab: Yes
 | 
					 | 
				
			||||||
NumSpacesForTab: 2
 | 
					 | 
				
			||||||
Encoding: UTF-8
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
RnwWeave: Sweave
 | 
					 | 
				
			||||||
LaTeX: pdfLaTeX
 | 
					 | 
				
			||||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
		Reference in New Issue
	
	Block a user