The script will do the PCA for the Linear-Accelerator data from the csv file we got from the Android App.
Then it will filter the result of the PCA and draw three plots about the Phone A's movement, Phone B's movement and the correlation between the two dataset.
Make sure you have installed the R language in your system. If not, please download it from R-Project offical website
Then please install the R packages via the install.packages()
command:
- ggplot2
- cowplot
- signal
- scales
Put the two csv file in the folder and rename them (or modified the script line 8 and 9)
Open the terminal (PowerShell, Tilix, iTerm2, whatever)
Change directory to the R_script folder
Run Rscript run.r
The plot will create in the folder named "output_plot.pdf", the importance of components of PCA will output in the terminal.
If you want to change the size of the plot, just modified the last line of the script.
Thanks for the rowr.r file from @cvarrichio