I have data arranged as below. My groups are in columns, I have two groups illustrated below. My actual data set contains about 15 paired variables.
How can I manipulate this data (an imported csv) in R so that I can compare the two groups? For example if I wanted to make a bargraph (using the sciplot library) bargraph.CI (var_x, group, data=mydata), how can I get these columns to be used as groups?
Time var_x var_y var_x_2 var_y_2 var_z var_z_2
10:00 2 5 .33 .36 1.1 1.5
10:01 2 6 .34 .35 1.2 1.4
etc
Here’s an answer using
reshapein base, though I am sure there are a multitude of ways to tackle this issue.Firstly, recreate the test data:
Reshape the data and save to a new data.frame
Run the barplot code: