I have a table with columns ranging from foo1...... foo999 . Could you give me a code in R to extract a set number of columns as needed by the user. The user should be able to decide about what range of columns he needs i.e from 1 to 60 in a separate table or maybe its 1 to 565 that the user needs. I tried a couple of methods. This is what I have currently. The solution seems to be quite basic but I can't find it anywhere.
number <- readline(prompt="Enter the number of columns: ")
subset(data, select=foo1:foo(number))
The expected output is the contents of the columns from the range that the user needs preferably stored in another variable so that I could use the data for further analysis.