LilahMcC / NarwhalHR

0 stars 1 forks source link

Pivoting acceleration #6

Open FlukeAndFeather opened 2 years ago

FlukeAndFeather commented 2 years ago

Try pivoting the acceleration data into long format and plotting all three axes together. The tidyr documentation is your reference here. You want to go from:

datetime acc_x acc_y acc_z
t1 ax1 ay1 az1
t2 ax2 ay2 az2
t3 ax3 ay3 az3

To:

datetime axis acc
t1 x ax1
t1 y ay1
t1 z az1
t2 x ax2
t2 y ay2
t2 z az2
t3 x ax3
t3 y ay3
t3 z az3

Then, in your call to ggplot(), make acc your "y" aesthetic and axis your "color" aesthetic.

https://github.com/LilahMcC/NarwhalHR/blob/4cd408bc30265f70d09617ad01e660a75d518ac7/pitch_roll.Rmd#L80-L82