R - Getting Column of Dataframe from String [duplicate]
问题 This question already has answers here : Dynamically select data frame columns using $ and a vector of column names (8 answers) Closed 3 years ago . I am trying to create a function that allows the conversion of selected columns of a data frame to categorical data type (factor) before running a regression analysis. Question is how do I slice a particular column from a data frame using a string (character). Example: strColumnNames <- "Admit,Rank" strDelimiter <- "," strSplittedColumnNames <-