[chronojump] getSprintFromRadar allows to select the decimal separator
- From: Xavier Padullés <xpadulles src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump] getSprintFromRadar allows to select the decimal separator
- Date: Thu, 11 May 2017 08:01:08 +0000 (UTC)
commit 331c1de0a99dedd8928dcc950876fe8a7330d49b
Author: Xavier Padullés <x padulles gmail com>
Date: Tue May 9 19:00:15 2017 +0200
getSprintFromRadar allows to select the decimal separator
r-scripts/sprintRadar.R | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
---
diff --git a/r-scripts/sprintRadar.R b/r-scripts/sprintRadar.R
index b7bcd27..dbfd9e6 100644
--- a/r-scripts/sprintRadar.R
+++ b/r-scripts/sprintRadar.R
@@ -41,12 +41,12 @@ op <- assignOptions(options)
#Reads a .rad file, trims the header and the last line and finds the curve that best fits with the data of
the file.
-getSprintFromRadar <- function(radFile)
+getSprintFromRadar <- function(radFile, decimalSeparator = ",")
{
nlines = length(readLines(radFile)) # The number of lines of the file
#Store the values of the file in the radar variable
#Skips the 18 first lines and the las line
- radar = read.fwf(file=radFile, sep="", widths = c(7, 8, 8, 8, 9), dec = ",", skip = 18, n = nlines -
19)
+ radar = read.fwf(file=radFile, sep="", widths = c(7, 8, 8, 8, 9), dec = decimalSeparator, skip = 18,
n = nlines - 19)
radar = radar[1:(length(radar[,1]) -1 ),] #Trim the last line
radar[,2] = as.numeric(gsub(",", "\\.", radar[,2])) #Substitute the comas by dots in the second
column
radar = data.frame(t = na.omit(radar[,2]), v= na.omit(radar[,3]), position = na.omit(radar[,5]))
@@ -123,7 +123,7 @@ getRadarDynamicsFromFolder <- function(radDir, athletesFile, splitDistance, resu
options(warn = -1)
#Adjusting the measured data to the model of getSprintFromRadar
- model = getSprintFromRadar(paste(radDir, "/", originalFiles[n], sep=""))
+ model = getSprintFromRadar(paste(radDir, "/", originalFiles[n], sep=""), decimalSeparator =
decimalSeparator)
options(warn = 0)
K = model$K
Vmax = model$Vmax
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]