I am working with R.
I have a data set that looks like this...
structure(
list(
Condition = c(
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1"
),
category = c(
"work",
"work",
"work",
"work",
"work",
"people",
"people",
"people",
"people",
"people",
"class",
"class",
"class",
"class",
"class",
"beach",
"beach",
"beach",
"beach",
"beach",
"park",
"park",
"park",
"park",
"park",
"house",
"house",
"house",
"house",
"house",
"street",
"street",
"street",
"street",
"street",
"internet",
"internet",
"internet",
"internet",
"internet"
),
Value = c(
7.36,
7.92,
7.66,
6.92,
4.76,
2.82,
3.18,
2.1,
8.28,
7.26,
5.16,
5.72,
7.12,
7.14,
5.06,
5.14,
3.34,
4.74,
NA,
NA,
3.42,
3.87,
5.3,
4.26,
4.46,
5.1,
3.76,
10.4,
3.38,
4.86,
4.14,
4.24,
4.68,
5.18,
4.46,
8.38,
3.92,
4.14,
4.78,
2.94
)
),
row.names = c(NA, -40L),
class = c("tbl_df", "tbl",
"data.frame")
)
So, as you can see the words in the category column repeat themself 5 times. Those "chunks" of five words are like a group that it is within the condition 1. So, I need a random sample of 4 chunks of words. That is a total of 20 observations under the value column.
I expect something like this...
Condition category Value
1 people #
1 people #
1 people #
1 people ...
1 people
1 street
1 street
1 street
1 street
1 street
1 park
1 park
1 park
1 park
1 park
1 class
1 class
1 class
1 class
1 class
Any help would be great. Thanks!