Jump to content


Photo

Sequential numbering


  • Please log in to reply
8 replies to this topic

#1 CTUK

CTUK

    Member

  • Members
  • PipPip
  • 10 posts

Posted 27 February 2018 - 12:45 PM

Is there an object or method for creating a column of sequential numbers?

I've tried enumerate and rank object, however these objects depends on the other columns being sort. What i'm after is independently assigning number 1 to X down the column.



#2 bwendt@certara.com

bwendt@certara.com

    Advanced Member

  • Administrators
  • 282 posts

Posted 27 February 2018 - 12:53 PM

The Enumerate object is the method of choice for generating an index column. If you want a random assignment you can generate a column with a random number using Data Wizard  and a Custom Transformation like rand(0,1,ID). Then you can use this random column for enumeration.



#3 CTUK

CTUK

    Member

  • Members
  • PipPip
  • 10 posts

Posted 27 February 2018 - 03:11 PM

The Enumerate object is the method of choice for generating an index column. If you want a random assignment you can generate a column with a random number using Data Wizard  and a Custom Transformation like rand(0,1,ID). Then you can use this random column for enumeration.

Thank you for your reply. Unfortunately the rand function generated the same random number within every cell of the same column.



#4 bwendt@certara.com

bwendt@certara.com

    Advanced Member

  • Administrators
  • 282 posts

Posted 27 February 2018 - 03:15 PM

You can use any numerical column to give the random number a different seed, i.e. the third argument of the rand() function. Would that help?



#5 Simon Davis

Simon Davis

    Advanced Member

  • Administrators
  • 1,318 posts

Posted 27 February 2018 - 03:54 PM

CTUK - can you perhaps post a CSV or PHXPROJ illustrating exactly what it is you want to do?

 

Is it you want one sequence to continue over all profiles or what?  Enumerate can use user values and data transformations are normally quite flexible.

 

 thanks. SImon.



#6 CTUK

CTUK

    Member

  • Members
  • PipPip
  • 10 posts

Posted 27 February 2018 - 04:25 PM

Hi Simon,I have attached a table of what I'm looking to achieve. I would like to create a a column (labelled as sequence below), with numbers increasing in ascending order.

 

Time Conc Sequence 0 0 1 1 20 2 2 80 3 4 200 4 8 160 5 12 80 6 24 40 7

#7 CTUK

CTUK

    Member

  • Members
  • PipPip
  • 10 posts

Posted 27 February 2018 - 04:27 PM

I have attached a photo instead

Attached Thumbnails

  • example.png

Edited by CTUK, 27 February 2018 - 04:28 PM.


#8 Simon Davis

Simon Davis

    Advanced Member

  • Administrators
  • 1,318 posts

Posted 28 February 2018 - 01:34 PM

I think the attached example using enumerate covers a couple of options that you want to do, resetting the sequence within profile or not.

 

Please take a look at this and let us know if there is something missing.

 

 Simon.

Attached Files



#9 CTUK

CTUK

    Member

  • Members
  • PipPip
  • 10 posts

Posted 28 February 2018 - 02:33 PM

I think the attached example using enumerate covers a couple of options that you want to do, resetting the sequence within profile or not.

 

Please take a look at this and let us know if there is something missing.

 

 Simon.

 

Hi Simon

 

Thank you very much for providing the example. It is very useful. I can see from the first workflow that it's just a matter of creating a unique combination of each row in order to enumerate a unique number each time.

 

For the attached file, I've also added an extra column to the data "Occasion" with the same subject and timepoints. The enumerate method works if the Occasion column is included for sorting as well.

Attached Thumbnails

  • code example.png

Edited by CTUK, 28 February 2018 - 02:33 PM.





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users