cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • Don’t miss your chance to experience Discovery Summit Europe at our best available rate! Early bird registration through 31 Oct.
  • Image to Table JMP extension imports single or batch images as data tables. Useful to extract curves from pictures or convert image data to curve data to use in analyses like Functional Data Explorer. Download and install the extension.

Discussions

Solve problems, and share tips and tricks with other JMP users.
Choose Language Hide Translation Bar
KostasV
Level I

Copy column values to nearest integer

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

Re: Copy column values to nearest integer

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

View solution in original post

2 REPLIES 2
txnelson
Super User

Re: Copy column values to nearest integer

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
Level II

Re: Copy column values to nearest integer

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.

Recommended Articles