I would like to create a vector of pairlist (flag, binary_value) like: (variable ="TrendOff", value = 0) (variable ="MOdwt", value = 1) (variable ? "ZeroPadding", value =1) ................................................
I tried the following syntax but the emcompassing list (that I called "flags") is not made up of pairlists. Instead it is made up of two apparently disjoint lists: > flags_val <- c( 0,1,1,1,4,1,1,1,4,1,1,1,4,1,1,1,4,1,1) > flags_nam <- c("TrendOff","MOdwt","ZeroPadding", + "Step1HSOff","Step1NumHSOff","Step1NumHSOff","Step1ExtOff", + "Step2HSOff","Step2NumHSOff","Step2NumHSOff","Step2ExtOff", + "Step3HSOff","Step3NumHSOff","Step3NumHSOff","Step3ExtOff", + "Step4HSOff","Step4NumHSOff","Step4NumHSOff","Step4ExtOff" ) > flags_nam [1] "TrendOff" "MOdwt" "ZeroPadding" "Step1HSOff" "Step1NumHSOff" "Step1NumHSOff" [7] "Step1ExtOff" "Step2HSOff" "Step2NumHSOff" "Step2NumHSOff" "Step2ExtOff" "Step3HSOff" [13] "Step3NumHSOff" "Step3NumHSOff" "Step3ExtOff" "Step4HSOff" "Step4NumHSOff" "Step4NumHSOff" [19] "Step4ExtOff" > flags <- pairlist (data = flags_val, variable = flags_nam) > flags $data [1] 0 1 1 1 4 1 1 1 4 1 1 1 4 1 1 1 4 1 1 $variable [1] "TrendOff" "MOdwt" "ZeroPadding" "Step1HSOff" "Step1NumHSOff" "Step1NumHSOff" [7] "Step1ExtOff" "Step2HSOff" "Step2NumHSOff" "Step2NumHSOff" "Step2ExtOff" "Step3HSOff" [13] "Step3NumHSOff" "Step3NumHSOff" "Step3ExtOff" "Step4HSOff" "Step4NumHSOff" "Step4NumHSOff" [19] "Step4ExtOff" Please, can someone teach me how to create a vector of pairlists ? I could find no illustrating on-line example. Thank you very much. Maura tutti i telefonini TIM! [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.