I am creating a script that will import a .txt file and do some manipulation. I want the column names to be a concatenation of rows 1 and 2. In other words, on row 1 I have things like "length" and "width," on row 2 I have things like "meters" and "centimeters," and on rows 3 through x I have the values. So I want to concat "length" with "meters" and make it the column name for column one, with all the data values starting on the new row 1.
Any pointers on how to get started or suggestions of some things that might be helpful?
It worked for me, but I could reproduce the same error with another file I tried. I have edited the script above: char() is used to avoid that concat fails for numeric column names. And I changed the counter i to j because the forum sometimes refuse to show i within square brackets (at least my browser did not show the names properly).
Now it should be complete. At least it works as expected for me with a range of text files (JMP9 for Mac).
FWIW I avoid using j as a looping variable, because it's a JSL matrix function!
J(nrows, , ) Function: Creates a matrix of identical values. Returns: The matrix. Arguments: nrows Number of rows in matrix. If ncols is not specified, nrows is also used as ncols. ncols Number of columns in matrix. value The value used to populate the matrix. If value is not specified, 1 is used.
j will work as a variable, but I tend to use i, k, m, n, etc.