3 ms·
I have a feeling that everything involving strings in R is a major headache. Case in point: - stringsAsFactors is True by default, leading to all kinds of wei
by a_bonobo 11y ago
I have a feeling that everything involving strings in R is a major headache.
Case in point:
- stringsAsFactors is True by default, leading to all kinds of weird silent behaviors
- length('string') being 1, since that's silently a vector of length 1 (~ length(c('string')) ). Have to use nchar() or str_length()
But, analyzing strings is pretty cool - stringdist() or levenshteinDist() are great!
- jackmaney 11y agoOh yes, stringsAsFactors...just seeing that almost conjures up flashbacks. Data frames in Pandas have no such implicit stupidity. The rough equivalent, IIRC, is setting up one or more columns as an index (or multi-index, respectively), and that's mostly done explicitly (with the exception of importing or exporting CSVs; the first column is imported as the index by default, and the index values are written out by default).