I have a folder with mutiple csv files having similar data structure whose data I need to process and store the results in a new file.
Each csv file has 2 columns, I need to process the data in the second column as follows:
- Name the second column as items
- Perform the following operation on all rows creating a new column x with the following formula :36 + -19.5 * :items+ 49.99 *:items* :items* :items
- Perform the following operation on all rows of column x creating column y:
Mean( :x[Index( Row() - 4, Row() )] ) - Find the mean and max of column y
- Store the value mean and max into the file and repeat the same procedure for other files as wellPfa sample csv file.
I am tring something as below but since just a beginner so culd yu please help
// Read all the file names
files = Files In Directory( "C:\Users\MyUserName\Documents\My Data\" );
X = N Items( files );
Y = "C:\Users\MyUserName\Documents\My Data\";
//stores the mean and max value of each file
dt = New Table( "My data file");
For( i = 1, i < X, i++,
//open jmp files for each csv files.
dt1 = Open(
Y || files[i],
//Code to add column name and the find mean and max
);
dt1 << Set Name( files[i] );
//I concatenated all the files in one jmp file and close it each time.
dt << Concatenate( Data Table( dt1 ), "Append to first table" );
Close( dt1 );
);