I’ve posted 6 lessons on YouTube to help you get started with JSL. You can access the playlist below. And if you’ve worked through all the lessons and would like a final copy of the code you can also download it from here.
Tag Archives: JSL Function
Transparency
Here’s a handy little function to apply a transparency effect to a solid (r,g,b) colour:
1 2 3 4 5 6 7 8 |
TransparentRGB = function({r,g,b,opacity=0.65},{default local}, red = opacity*r + (1-opacity); green = opacity*g + (1-opacity); blue = opacity*b + (1-opacity); return(RGBColor(red,green,blue)); ); |
JSL Cookbook
It’s been a while – so, since it’s Friday, here is a collection of Friday’s Functions … some of my favourite user-defined functions.
The JMP website has introduced a similar theme, JSL Cookbook, so probably I will change the tag associated with these posts to be JSL Cookbook instead of Friday’s Functions.
Remove Empty Columns
It’s not Friday. But I’ve just written this function and I thought I’d share it. Plus it’s Christmas. Almost.
Some background: I’ve just loaded a spreadsheet into a JMP table and it contains 257 columns. Only 55 of the columns contain data. This function will zap the empty columns and make the table more manageable.
Is Column Singular
Not only do singularities cause havoc to the fabric of spacetime, but they also cause your table splits to fall apart and your models to break with ugly error messages.
Today’s function is a utility to evaluate an individual data column to evaluate whether it is singular (i.e. the column has constant values through all of the rows).
Missing Columns
For this week Friday’s Function is a utility to check the availability of required columns.
(more…)
Data Table To Table Box
This week’s Friday Function is a utility that allows me to display the contents of a table in a window.
Day Of Week As String
Today’s Friday Function is a utility that converts a datetime into a day of the week, expressed as a string. JSL contains a function Day Of Week which gives the day as a number; this number is used as an input into a Choose function to convert it to a string.
Column Exists
This Friday’s function is a simple utility to determine whether a column exists in a table.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
Column Exists = Function({dt,colName},{Default Local}, Try( lstNames = dt << Get Column Names(string); pos = Loc(lstNames,colName); If (NRows(pos)==0, retVal = 0 , retVal = 1 ) , retVal = 0 ); Return(retVal) ); |
Typically I use this in conjunction with an Assert function:
1 2 3 |
Assert( Column Exists(dt,col), "Column Not Found" ); |
Friday’s Function
I have a library of utility JSL functions that I rely on to perform common tasks. Each Friday I will publish one of them; starting today.