Home > Back-end >  How to index when using colnames to create a list with all colnames in R(data frames)
How to index when using colnames to create a list with all colnames in R(data frames)

Time:01-25

I have a problem regarding the following issue:

I need all columnames aport from V1 till the end V200 in a list, but I don't know how and where to insert the index into these lines of code. Like this, it gives me a list of all columnames but I don't need the first two. Please help, thank you!

enter image description here

CodePudding user response:

Update, once more, thanks to akrun for a better/shorter solution:

names(df)[3:ncol(df)]

For dataframes there is no need to use colnames, it's the same like names. The difference is only in case you're dealing with matrices

  •  Tags:  
  • Related