rmatrixs-plus

name.cols command in Splus to R


I have a code in Splus, but have to convert it into R, which is not a big thing. However I am very new to both softwares. This is the code I am struggling with:

 name.x<-name.cols(x)

x is a matrix of independent variables where first length(keep1) columns correspond to variables that are always kept in BMA (Bayesian Model Averaging -- this isn't important. Essentially, x is a matrix)

R does not recognize this command. What is name.cols doing, and how can I do the same thing in R? How do I modify this command?


Solution

  • The function colnames returns the column names of an object in R:

    name.x <- colnames(x)