Retrieving column names in R
Your data boils down to something like this structure:

&gt; str(model)
List of 2
 $ data:List of 1
  ..$ : int [1:3, 1:4] 1 2 3 4 5 6 7 8 9 10 ...
  .. ..- attr(*, "dimnames")=List of 2
  .. .. ..$ : NULL
  .. .. ..$ : chr [1:4] "a" "b" "c" "d"
 $ foo : num 1


but you have some other components that we don't need to bother with, and my data doesn't have row names and is a lot smaller.

model is a list of 2 (for me) and 13 (for you) parts.

The $data component is also a "List of 1" component. 

So colnames(model$data) is trying to get the colnames of a list, and failing:

&gt; colnames(model$data)
NULL


Which you would have spotted if you'd tried running colnames(model$data) yourself.

You want the colnames of the first element of the list model$data:

&gt; colnames(model$data[[1]])
[1] "a" "b" "c" "d"


and hence:

&gt; sample(colnames(model$data[[1]]),1)
[1] "b"


Its possible that because this is a "kohonen" class object that there are functions that get these data matrices for you. You'll need to read the documentation to figure this out. What I've shown above is digging in the structure to find the data you want.