- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Add column names for my data
I have many CSV files that came in directly with data but no column names. I am wondering how can I script to add column names for these data? Current column name is whatever the first number for each column.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Add column names for my data
It seems like you need to change your Excel preferences, to read in the first line as the column names. If you edit the "Source" entry in the data table, you should see what line the headers are on, and what line the data starts on.
Short of this, this little script will take the values in row 1, and make them the column headers
names default to here(1);
dt=current data table();
for(I=1,i<=Ncols(dt),i++,
column(i) << set name(column(i)[1])
);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Add column names for my data
Thanks for the response. My issue is I don't have a column name included in my original data table from CSV. The JMP just directly read my first row in my CSV file as the column name. Do you know there is a way that I can insert column name into data table from JMP?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Add column names for my data
You need to use the Excel Wizard when openning the spreadsheet. It will allow you to not read in the headers. All you need to do, is to go to
File==>Open
then navigate to the Excel file you want to read in
Single click on the file you want to read in, and then click on the down arrow next to the Open, and select Excel Wizard. It will walk you through the options on how to read in your Excel File.
Once you have read in one file, you can right click on the "Source" green triangle in the Table Panel in the upper left corner of the JMP Data table. If you select Edit, you will see the JSL that you can use to read in the Excel Files