Hi there,
I need to create subsets from a series of numeric values. I've created a .csv file with two columns (fragment below). the first column (onsets) has the data from which I want to extract the subsets, and the second column (phrase.constraint) provides the limits of each subset.
onsets phrase.constraint
0.6502 0.65
0.7271 3.512
0.8998 13.3079
1.0681
1.2702
1.6718
1.8736
2.0898
2.4294
2.5426
2.8473
3.5367
3.692
3.7849
5.6874
6.6873
7.2838
7.9644
8.5595
9.1138
9.4723
9.8757
10.1152
10.2777
10.4795
10.6246
10.7624
10.8829
10.954
14.051
My aim is to write a code that will create subgroups considering the range provided by the column "phrase.constraint". The first subset would be composed of the numbers between 0.65 and 3.512 (the two first values from column "phrase.contraint". Therefore, it would include the eleven numbers from 0.6502 till 2.8473.
I tried the following code:
library(dplyr)
phrases<-read.csv("SinopoulosHicaz02_onsets_phrases.csv")
phrases=as.data.frame(phrases)Subset1 = filter(phrases, between(phrase.constraint, 1,2 ))
The goal was that 1 and 2 would indicate the rows from "phrase.contraint" that would limit my subset - in this case, it would select the eleven numbers between 0.65 3.512, but I can't seem to figure out how to do that.
This is my first post so I'm sorry if this is not very clear.
Thank you in advance!