I don't really understand what you mean by this but selecting a sample number of rows from a data set only requires use of sample_n(). In the example below, I'm randomly selecting 3 rows from your data set.
Also, set.seed() takes a single value for the seed parameter, not a vector.
library(dplyr, warn.conflicts = FALSE)
data <- data.frame ("code" = c("4194", "asd45fg", "sadg65", "adfg65", "ad4fg65", "agg87", "fhfrh32","hjhj3", "8989", "dhjik1"),
"comp" = c(20, 30, 60, 65, 80, 100, 40, 37, 89, 10))
set.seed(42)
data_s1 <- sample_n(data, size = 3)
print(data_s1)
#> code comp
#> 1 4194 20
#> 2 ad4fg65 80
#> 3 dhjik1 10
Created on 2020-06-03 by the reprex package (v0.3.0)