STRLEN in a dataframe?

Hi,

I have a dataframe Olddata created with loadd() from a CSV file. The first three columns/variables are strings and the remaining columns are numerical values. I would like to organize my data according to the length of the string in the third column.

newdata = selif(olddata, strlen(olddatal[.,3]) .== 6) ;

The result this gives me, is the name of the variable in the first column, which makes no sense at all.

Even when I try

strlen(olddatal[3,3])

it just gives me a zero even though the length of string in [3,3] is actually 5.

However, it does work when I do this

newdata = selif(olddata, olddatal[.,3]) .== "01000") ;

It just seems that STRLEN is not really compitible with the strings in the dataframe. How else would I sort my data according to the length of the observations of a string variable?

Your Answer


You must login to post answers.

Have a Specific Question?

Get a real answer from a real person

Need Support?

Get help from our friendly experts.