R - convert a data frame to a data set formatted as featureName:featureValue [duplicate]
问题 This question already has answers here : read/write data in libsvm format (6 answers) Closed 5 years ago . It turns out the format I wanted is called "SVM-Light" and is described here http://svmlight.joachims.org/. I have a data frame that I would like to convert to a text file with format as follows: output featureIndex:featureValue ... featureIndex:featureValue So for example: t = structure(list(feature1 = c(3.28, 6.88), feature2 = c(0.61, 1.83 ), output = c("1", "-1")), .Names = c(