<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Renaming Columns in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Renaming-Columns/m-p/42407#M24652</link>
    <description>&lt;P&gt;Here is a simple script that will do what you need&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );
dt = Current Data Table();
ColList = dt &amp;lt;&amp;lt; get column names( string );

For( i = 1, i &amp;lt;= N Items( ColList ), i++,
	If( Substr( ColList[i], 1, 1 ) == "0",
		Column( dt, i ) &amp;lt;&amp;lt; set name( Substr( ColList[i], 2 ) )
	)
);&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Sat, 22 Jul 2017 01:38:53 GMT</pubDate>
    <dc:creator>txnelson</dc:creator>
    <dc:date>2017-07-22T01:38:53Z</dc:date>
    <item>
      <title>Renaming Columns</title>
      <link>https://community.jmp.com/t5/Discussions/Renaming-Columns/m-p/18632#M16984</link>
      <description>&lt;P&gt;Hi everyone,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In my code, I open up a csv file, and I rename the column to "Column 1".&amp;nbsp; In the data table, it is renamed, but when I search through all the different columns, it can't find "Column 1". It only recognizes its original name when it is opened.&amp;nbsp; I am searching for values with in a data table, and I need to know what column it is in (which is working if I set i to 2).&amp;nbsp; I know that setting i to 2 would work for this application, but in general, I think it would be good to know why this is happening.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;colFunction = Function({search_string},
&amp;nbsp; found =0;
&amp;nbsp; i=1;
&amp;nbsp; Show(search_string);
&amp;nbsp; Show(nCols);
&amp;nbsp; While (found == 0,
&amp;nbsp;
&amp;nbsp; match_rows = dt &amp;lt;&amp;lt; get rows where(as column(dt, nCols)==search_string);
&amp;nbsp; if(nrows(match_rows) &amp;gt; 0, found = 1, i++);
&amp;nbsp; if(i==nCols, found =1, );
&amp;nbsp; );
&amp;nbsp; col = Num(i);
);
&amp;nbsp;
file = Pick File();
dt = Open (file);
&amp;nbsp;
&amp;nbsp;
for(i=1, i&amp;lt;=ncols(dt), i++,
&amp;nbsp;
&amp;nbsp; column(dt,i) &amp;lt;&amp;lt; data type(Character);
&amp;nbsp; column(dt,i) &amp;lt;&amp;lt; set modeling type(continuous);
);
&amp;nbsp;
&amp;nbsp;
nCols = dt &amp;lt;&amp;lt; Get Column Names ("Character");
col = Column (1);
col &amp;lt;&amp;lt; set name("Column 1");
&amp;nbsp;
irglCol = colFunction("Irgl");&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 25 Jul 2017 17:32:41 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Renaming-Columns/m-p/18632#M16984</guid>
      <dc:creator>natalie_</dc:creator>
      <dc:date>2017-07-25T17:32:41Z</dc:date>
    </item>
    <item>
      <title>Re: Renaming Columns</title>
      <link>https://community.jmp.com/t5/Discussions/Renaming-Columns/m-p/18633#M16985</link>
      <description>&lt;P&gt;get column names gets just the list of column names&lt;/P&gt;
&lt;P&gt;get column references gets the names as strings&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;so maybe a couple of other ideas too.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;open(); //dont have to pick the file, it automatically opens the pic file dialogue&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Get the column list, find the position of the pattern and then change the column name using the position at the reference&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="margin: 0px; line-height: normal; font-family: Menlo; color: #008f00;"&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;list=dt&amp;lt;&amp;lt; get column reference();&amp;nbsp; //gets strings not a list of columns
position=contains(list, column("Carline"));&amp;nbsp;&amp;nbsp;&amp;nbsp; //finds the position of something in a list
&amp;nbsp;
column(position)&amp;lt;&amp;lt;setname("Caroline");&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;or I guess you could get really crazy and substitute in the list and rename all the columns with the list&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;newlist=substitute(list, string, "Column 1");
dt&amp;lt;&amp;lt;set column names(newlist);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 08 Sep 2017 16:52:27 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Renaming-Columns/m-p/18633#M16985</guid>
      <dc:creator>Byron_JMP</dc:creator>
      <dc:date>2017-09-08T16:52:27Z</dc:date>
    </item>
    <item>
      <title>Re: Renaming Columns</title>
      <link>https://community.jmp.com/t5/Discussions/Renaming-Columns/m-p/42406#M24651</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; I have a similar issue, but not exactly the same: I have a JMP table with 100's of columns and majority of those column names start with the number 0 which makes it hard to go/search for a specific column. is there a way I can remove the number 0 at the beginning of each column through a JMP script.&lt;/P&gt;&lt;P&gt;If it was one or two columns, I could have done it manually but these are in 100's...I know how to change name for one column at a time, but in this case I think i need to somehow use a loop or something...&lt;/P&gt;&lt;P&gt;please let me know if there are some ways this can be achieved.&lt;/P&gt;&lt;P&gt;appreciate all the help.&lt;/P&gt;&lt;P&gt;thanks.&lt;/P&gt;</description>
      <pubDate>Fri, 21 Jul 2017 23:23:59 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Renaming-Columns/m-p/42406#M24651</guid>
      <dc:creator>syedhashmi</dc:creator>
      <dc:date>2017-07-21T23:23:59Z</dc:date>
    </item>
    <item>
      <title>Re: Renaming Columns</title>
      <link>https://community.jmp.com/t5/Discussions/Renaming-Columns/m-p/42407#M24652</link>
      <description>&lt;P&gt;Here is a simple script that will do what you need&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );
dt = Current Data Table();
ColList = dt &amp;lt;&amp;lt; get column names( string );

For( i = 1, i &amp;lt;= N Items( ColList ), i++,
	If( Substr( ColList[i], 1, 1 ) == "0",
		Column( dt, i ) &amp;lt;&amp;lt; set name( Substr( ColList[i], 2 ) )
	)
);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 22 Jul 2017 01:38:53 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Renaming-Columns/m-p/42407#M24652</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2017-07-22T01:38:53Z</dc:date>
    </item>
    <item>
      <title>Re: Renaming Columns</title>
      <link>https://community.jmp.com/t5/Discussions/Renaming-Columns/m-p/42408#M24653</link>
      <description>&lt;P&gt;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/2687"&gt;@txnelson&lt;/a&gt;&amp;nbsp;showed you the scripting solution, but this is pretty easy to deal with interactively too.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can copy the column names from the list on the left side of the data table and then paste them into a column of a new data table. Now you've got access to all the capabilitles of the formula editor to manipulate them.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Then copy them from the new column and paste them back into the original table.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here's a little video showing the technique.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;div class="lia-vid-container video-embed-center"&gt;&lt;div id="lia-vid-52dzUxYzE6-Q3kzxgg0Rfu4SSO1v9PEzw400h300r730" class="lia-video-brightcove-player-container"&gt;&lt;video-js data-video-id="6064700497001" data-account="6058004218001" data-player="default" data-embed="default" class="vjs-fluid" controls="" data-application-id="" style="width: 100%; height: 100%;"&gt;&lt;/video-js&gt;&lt;/div&gt;&lt;script src="https://players.brightcove.net/6058004218001/default_default/index.min.js"&gt;&lt;/script&gt;&lt;script&gt;(function() {  var wrapper = document.getElementById('lia-vid-52dzUxYzE6-Q3kzxgg0Rfu4SSO1v9PEzw400h300r730');  var videoEl = wrapper ? wrapper.querySelector('video-js') : null;  if (videoEl) {     if (window.videojs) {       window.videojs(videoEl).ready(function() {         this.on('loadedmetadata', function() {           this.el().querySelectorAll('.vjs-load-progress div[data-start]').forEach(function(bar) {             bar.setAttribute('role', 'presentation');             bar.setAttribute('aria-hidden', 'true');           });         });       });     }  }})();&lt;/script&gt;&lt;a class="video-embed-link" href="https://community.jmp.com/t5/video/gallerypage/video-id/52dzUxYzE6-Q3kzxgg0Rfu4SSO1v9PEz"&gt;(view in My Videos)&lt;/a&gt;&lt;/div&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 22 Jul 2017 03:34:15 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Renaming-Columns/m-p/42408#M24653</guid>
      <dc:creator>Jeff_Perkinson</dc:creator>
      <dc:date>2017-07-22T03:34:15Z</dc:date>
    </item>
    <item>
      <title>Re: Renaming Columns</title>
      <link>https://community.jmp.com/t5/Discussions/Renaming-Columns/m-p/42446#M24669</link>
      <description>&lt;P&gt;totally awesome..works like a charm.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thanks a lot.&lt;/P&gt;</description>
      <pubDate>Mon, 24 Jul 2017 16:08:52 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Renaming-Columns/m-p/42446#M24669</guid>
      <dc:creator>syedhashmi</dc:creator>
      <dc:date>2017-07-24T16:08:52Z</dc:date>
    </item>
  </channel>
</rss>

