csv - R character factor to numeric vector -
i read in csv file "3:29" in 1 of fields (without quotation marks). comes factor. how can convert numeric vector e.g. c(3:29)? tried as.vector() gives string vector "3,4,5,6...29" (with quotation marks, still character class).
edit answer needs applicable more general form, example, column contain 3:6,7,9:11, needs converted equivalent c(3:6,7,9:11).
you can do:
> eval(parse(text='3:29')) [1] 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 [26] 28 29
Comments
Post a Comment