forked from ScreamingPigeon/ms-analysis-23
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsegmentationverification.R
More file actions
51 lines (46 loc) · 1.24 KB
/
segmentationverification.R
File metadata and controls
51 lines (46 loc) · 1.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
library(ez)
library(ggplot2)
library(plyr)
library(reshape2)
library(pbkrtest)
library(multcomp)
library(Hmisc)
library(readxl)
library(tidyverse)
library(stringr)
library(fs)
library(writexl)
library(xlsx)
library(openxlsx)
library(arrow)
library(tibble)
library(data.table)
participant <- dir_ls("C:\\Users\\Chang\\Documents\\researchstuff\\MS\\MS activities\\106")
test = "C:\\Users\\Chang\\Documents\\researchstuff\\MS\\MS activities\\106\\CHI2021 106B1_T2.csv"
big = data.frame()
big
resultant <- function(path){
dataf = read.csv(path)
dataf <- dataf[,-c(1)]
xyz <- dataf[,1:3]
t <- dataf[,4]
resultant <- sqrt((xyz[,1]^2) + (xyz[,2]^2) + (xyz[,3]^2))
#print(length(resultant))
dataf$resultant <- resultant
length <- (nrow(dataf))
activity <- seq(1, by = 0, length.out = nrow(dataf))
id = substring(path, 69, 90)
#print(id)
dataf$id <- id
dataf
}
combine <- map_dfr(
.x = participant,
.f = \(path) resultant(
path = path))
combine <- as.data.frame(combine)
ggplot(data = combine, mapping = aes(x = t, y = resultant, group = id)) + geom_line(aes(colour = id), alpha = 0.6)
#p+scale_color_manual(values =c("#741B47", "#007777"))
resultant(test)
nrow(combine)
typeof(combine)