How can I update this code so that whatever output is selected, the sub.set data becomes an output dataframe to my global environment? I want to create the data to the global en