I want to create a list based on the information from a data.frame, Model. So I tried the following:
MyList <- list(colnames(Model)[2] = levels(Model$(colnames(Model)[2]))) but it failed with an error: Error: unexpected '=' in "list(colnames(Model)[2] =" I have the following problems with this command line: (1) I wanted to use colnames(Model)[2] as a tag for the list: > colnames(Model)[2] [1] "gender" but it is not working as I intended. How to make colnames(Model)[2] a legitimate tag? (2) Model$gender is a column in the data.frame. However Model$ (colnames(Model)[2]) seems not recognizable in the command line. How to correct this? (3) How to add more tagged items to an existing list? cbind or rbind? Thanks in advance, Gang ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.