33# ' @srrstats {G1.4} roxygen2 used to document functions
44# ' @inheritParams concstats_top_df
55# ' @return A `data frame`.
6+ # ' @note Note that the first column in your data frame will be the index
7+ # ' and values should be unique.
68# ' @family Market structure measures
79# ' @rdname concstats_top5_df
810# '
1517# '
1618# ' @export
1719concstats_top5_df <- function (x , y , digits = NULL ) {
18- # ' @srrstats {G2.1} Assertions on types of inputs
19- # ' @srrstats {G5.8a} Zero-length data
20- # ' @srrstats {G2.2, G2.6, G2.7, G2.16} Checking class, type, NaN handling
21- # ' @srrstats {EA2.6}
20+ # ' @srrstats {G2.1} Assertions on types of inputs
21+ # ' @srrstats {G5.8a} Zero-length data
22+ # ' @srrstats {G2.2, G2.6, G2.7, G2.16} Checking class, type, NaN handling
23+ # ' @srrstats {EA2.6}
2224 # Checking if an argument is a data frame with specific column names
2325 checkmate :: assert_data_frame(x , types = c(" numeric" , " character" ),
2426 col.names = " unique" ,
@@ -28,7 +30,13 @@ concstats_top5_df <- function(x, y, digits = NULL) {
2830
2931 x <- tibble :: as_tibble(x )
3032
31- # ' @srrstats {G2.10, G2.11, G2.12} data frame pre-processing
33+ # ' @srrstats {EA2.0, EA2.1, EA2.2, EA2.2b}
34+ attr(x , " index" ) <- x [[1 ]]
35+ if (anyDuplicated(x [[1 ]])) {
36+ stop(" Your first column has duplicated values" )
37+ }
38+
39+ # ' @srrstats {G2.10, G2.11, G2.12} data frame pre-processing
3240 if (anyNA(x )) {
3341 message(paste(" NA values have been removed before the calculation for the following variable: " , y ))
3442 }
0 commit comments