0

Here I am trying to name the individual elements of this list as a function of x so that I may index it later like one would with a dataframe or vector, yet I keep getting the error message

Error: unexpected '=' in "Indxlist <- sapply(1:1600, function(x) list( (x) ="

Here is the code that I am attempting to use...

Indxlist <- sapply(1:1600, function(x) list( (x) = dataframe1[,x]))

Thanks!

Zach Eisner
  • 114
  • 9

1 Answers1

0

I think this cannot work. You cannot name a list with integers. Just do this after your command (which is not good practice anyways):

names(Indxlist) <- 1:1600
  • 1
    That worked! And thanks for the good practice note. As can be seen, I'm very new and inexperienced with coding. Thank you for the help though! – Zach Eisner Jul 13 '16 at 17:01
  • Glad, if that helped. If you want to accept this answer, I'd appreciate it. :) –  Jul 14 '16 at 08:38