Openrefine: Add a new range() function to GREL

Created on 10 Nov 2017  路  3Comments  路  Source: OpenRefine/OpenRefine

Use case taken from mailing list
https://groups.google.com/d/topic/openrefine/SE2F7tn3lH0/discussion

Hello all,

I've been trying to figure this out, but need some help. I have a column full of ranges of numbers, e.g.:

row 1: 2-4
row 2: 7-12

I would like to be able to convert the cell so that it displays

row 1: 2,3,4
row 2: 7,8,9,10,11,12

My eventual goal being to split the cell with each number on a separate row in the record with Split multivalued cells. Is there a way to do this in OpenRefine?

Thank you!!
Olivia

enhancement good first issue logic Medium

Most helpful comment

I will try to work on this in the next few days :)

All 3 comments

It will work like this...

can take a String form:
range("2-4") --> [2,3,4]

or a String form in a value
range(value) --> [2,3,4]

or 2 numbers
range(2, 4) --> [2,3,4]

and doing join(",") will convert the Array to a String
range(2,4).join(","). --> 2,3,4

I will try to work on this in the next few days :)

@joanneong Thanks for working so diligently on this ! Great job !

Was this page helpful?
0 / 5 - 0 ratings