Subscribe Bookmark RSS Feed

Copy column values to nearest integer

KostasV

New Contributor

Joined:

Oct 19, 2017

Hi JMP community,

I have the following dataset:

 

table.jpg

and I want to copy, from inside the table environment column X2 and X3 values to two new columns but rounded up to the nearest integer.

So first rows would give lets say:

9  5

7  0

15  0

and so on

I know that you can do this easily just by copy paste the values in excel and include a function there but I dont want to include a third party tool, I am pretty sure I can do it easily inside JMP somehow.

Thanks

1 ACCEPTED SOLUTION

Accepted Solutions
txnelson

Super User

Joined:

Jun 22, 2012

Solution

Simply create a new column and specify the following formula

     

Round(:X2, 0 )
New Table( "Example",
	Add Rows( 40 ),
	New Column( "X2",
		Numeric,
		"Continuous",
		Format( "Best", 12 ),
		Set Selected,
		Set Values(
			[0.222296780906617, -0.208880377933383, 0.948435816913843,
			-0.223318483680487, 0.348921137861907, 0.661695904098451,
			-0.79871425870806, -0.2668949784711, 0.8907325360924, 0.841785247903317,
			-0.707082123029977, 0.0489646322093902, -0.795245121698827,
			-0.274563614744693, -0.0984594593755902, 0.0850535412319002,
			-0.289936773944646, 0.37708281353116, 0.376254497095942,
			-0.378620598930866, -0.796597009990364, 0.834386725910008,
			0.971540253143757, -0.848479581996799, 0.913042881526053,
			0.795696284156292, -0.0982480780221523, -0.537943015806377,
			-0.179191492497921, 0.96037309942767, -0.853838890325278,
			0.451878123916685, -0.742894380353391, 0.886242488399148,
			0.291709554381668, 0.818332622293383, -0.657034539617598,
			-0.327543308958411, -0.430723237805069, 0.415282697882503]
		)
	),
	New Column( "Column 7",
		Numeric,
		"Continuous",
		Format( "Best", 12 ),
		Formula( Round( :X2, 0 ) )
	)
)

round.PNG

Jim
2 REPLIES
txnelson

Super User

Joined:

Jun 22, 2012

Solution

Simply create a new column and specify the following formula

     

Round(:X2, 0 )
New Table( "Example",
	Add Rows( 40 ),
	New Column( "X2",
		Numeric,
		"Continuous",
		Format( "Best", 12 ),
		Set Selected,
		Set Values(
			[0.222296780906617, -0.208880377933383, 0.948435816913843,
			-0.223318483680487, 0.348921137861907, 0.661695904098451,
			-0.79871425870806, -0.2668949784711, 0.8907325360924, 0.841785247903317,
			-0.707082123029977, 0.0489646322093902, -0.795245121698827,
			-0.274563614744693, -0.0984594593755902, 0.0850535412319002,
			-0.289936773944646, 0.37708281353116, 0.376254497095942,
			-0.378620598930866, -0.796597009990364, 0.834386725910008,
			0.971540253143757, -0.848479581996799, 0.913042881526053,
			0.795696284156292, -0.0982480780221523, -0.537943015806377,
			-0.179191492497921, 0.96037309942767, -0.853838890325278,
			0.451878123916685, -0.742894380353391, 0.886242488399148,
			0.291709554381668, 0.818332622293383, -0.657034539617598,
			-0.327543308958411, -0.430723237805069, 0.415282697882503]
		)
	),
	New Column( "Column 7",
		Numeric,
		"Continuous",
		Format( "Best", 12 ),
		Formula( Round( :X2, 0 ) )
	)
)

round.PNG

Jim
volinoca

Community Trekker

Joined:

Sep 13, 2014

If your factor levels are widely spread apart, you could always just format the display of the columns to 'Fixed Decimal' with zero decimals places to show. It doesn't change the values, but it provides a table to print. Otherwise you can use the Round() or Floor() functions in two newly created columns as previous poster suggested.