I have column names like cc32.1_1,cc32.1_2,cc32.1_3,cc32.1_4,cc32.1_text,cc33.1_1,cc33.1_2,cc33.1_3,cc33.1_Text,cc33.2_1,cc33.2_2,cc33.2_3,cc33.2_4,cc33.2_5,cc33.2_6,cc33.2_7,cc33.2_8,cc33.2_8,cc33.2_9,cc33.2_10,cc33.2_11,cc33.2_Text.
i want to give parameter like "cc32.1_" so that it can select vaiables c(cc32.1_1,cc32.1_2,cc32.1_3,cc32.1_4) and except cc32.1_text and same as for "cc33.2_11" and select all vars c(33.2_1,cc33.2_2,cc33.2_3,cc33.2_4,cc33.2_5,cc33.2_6,cc33.2_7,cc33.2_8,cc33.2_8,cc33.2_9,cc33.2_10,cc33.2_11)
Fun1<- function(dataset,pattern,banner,label){
print(pattern)
npatt<-paste0(pattern, ".*(?<!_TEXT)$")
vars = grep(npatt, colnames(dataset), value = TRUE)
Fun1(dataset=data, pattern="cc32.1_",banner=banner,label="Table 1")