I am running multiple data analysis scripts with are often oneway analyses or t-tests.
I have written or generated many of these myself but I have run into a recurring problem.
I will often generate the code while on one data table and then when I paste it to another data table with the same headings the script replaces single or multiple variables with "As Column()"
So if I have this:
Oneway(
Y( :"parameter 1" ),
X( :"parameter 2" ),
Each Pair( 1 ),
Means( 1 ),
Mean Diamonds( 1 ),
SendToReport(
Dispatch( {}, "Oneway Anova", OutlineBox, {Close( 1 )} ),
Dispatch(
{"Means Comparisons", "Comparisons for each pair using Student's t"},
"LSD Threshold Matrix",
OutlineBox,
{Close( 1 )}
),
Dispatch(
{"Means Comparisons", "Comparisons for each pair using Student's t"},
"Connecting Letters Report",
OutlineBox,
{Close( 1 )}
)
)
)
I end up with this non-functioning code after pasting it
Oneway(
Y( :"parameter 1" ),
X( As Column() ),
Each Pair( 1 ),
Means( 1 ),
Mean Diamonds( 1 ),
SendToReport(
Dispatch( {}, "Oneway Anova", OutlineBox, {Close( 1 )} ),
Dispatch(
{"Means Comparisons", "Comparisons for each pair using Student's t"},
"LSD Threshold Matrix",
OutlineBox,
{Close( 1 )}
),
Dispatch(
{"Means Comparisons", "Comparisons for each pair using Student's t"},
"Connecting Letters Report",
OutlineBox,
{Close( 1 )}
)
)
)
Another issue that happens is the original working code will sometimes not open correctly when run directly but it will work if I click edit and can see the code.
Is there something I am doing incorrectly? I am running JMP 15.0.0
TLDR: I tried to paste code from one data table to another with the same headings. I expected it to work but it broke in an unexpected way.
Related
I'm trying to to group the values from an observable into an array of n size, to be able to batch send these to a service to improve the overall performance.
The thing is that I want to make sure that when the items left are less then n, they will be still be passed down the chain after a certain timeout.
I'm trying to rewrite the C# solution from
https://stackoverflow.com/a/22873833/2157455
in Javascript.
The main problem is that in Rx.Js lots of methods have been deprecated and it's hard to find the new functions.
var people = new List<(string name, int age)>
{
("Sue", 25 ),
("Joe", 30 ),
("Frank", 25 ),
("Sarah", 35 ),
("John", 37)
}.ToObservable();
var buffers = people
.GroupByUntil(
// yes. yes. all items belong to the same group.
x => true,
g => Observable.Amb(
// close the group after 5 seconds of inactivity
g.Throttle(TimeSpan.FromSeconds(5)),
// close the group after 10 items
g.Skip(1)
))
// Turn those groups into buffers
.SelectMany(x => x.ToArray());
I could get this far, but I can't find the replacement for groupByUntil. And I'm not sure what's the selectMany operator in Rx.Js, probably toArray().
Most examples I find are using deprecated or non-exising functions.
I'm using rxjs 7.8.0
The syntax does not help as well, using the pipe all the time makes the code difficult to read in my opinion.
const people = [
{ name: 'Sue', age: 25 },
{ name: 'Joe', age: 30 },
{ name: 'Frank', age: 25 },
{ name: 'Sarah', age: 35 },
{ name: 'John', age: 37 }
];
const source = from(people);
const example = source.pipe(
groupBy(person => true),
mergeMap(group => group.pipe(
raceWith(
group.pipe(throttle(() => interval(1000))),
group.pipe(skip(2))
),
toArray()
)));
example.forEach(x => console.log(x.length));
I'm getting all 5, instead of two arrays, one with 3 the other with 2.
Perhaps there is a better way to write it in js, but I can;t see the replacement for groupByUntil.
Thanks.
bufferTime is probably what you are looking for
One of its signature is :
bufferTime(bufferTimeSpan: number, bufferCreationInterval: number, maxBufferSize: number, scheduler?: SchedulerLike): OperatorFunction<T, T[]>
so with bufferTime(1000, null, 2) you get a buffered of length=2 or every 1s.
I have Power BI DAX query used in a measure. It takes longer time to execute. Can anyone please help me with this?
MEASURE FACT_CONSOL_BALANCE_OL[Measure 4] =
SWITCH (
TRUE (),
CONTAINS (
DIM_ANALYTIC_STRUCT_ACCOUNT,
DIM_ANALYTIC_STRUCT_ACCOUNT[STRUCTURE_NODE (groups)], "1 - CURRENT ASSETS"
), SUM ( FACT_CONSOL_BALANCE_OL[BALANCE] ),
CONTAINS (
DIM_ANALYTIC_STRUCT_ACCOUNT,
DIM_ANALYTIC_STRUCT_ACCOUNT[STRUCTURE_NODE (groups)], "2 - NON - CURRENT ASSETS"
), SUM ( FACT_CONSOL_BALANCE_OL[BALANCE] ),
SUM ( FACT_CONSOL_BALANCE_OL[BALANCE] ) * -1
)
Performance Result on DAX Studio:
Can you please try this code, see if It solves your problem. I tried to write it without contains() function.
MEASURE FACT_CONSOL_BALANCE_OL[Measure 4] =
SUMX (
FACT_CONSOL_BALANCE_OL,
VAR Balance =
SWITCH (
RELATED ( DIM_ANALYTIC_STRUCT_ACCOUNT[STRUCTURE_NODE (groups)] ),
"1 - CURRENT ASSETS", FACT_CONSOL_BALANCE_OL[BALANCE],
"2 - NON - CURRENT ASSETS", FACT_CONSOL_BALANCE_OL[BALANCE],
FACT_CONSOL_BALANCE_OL[BALANCE] * -1
)
RETURN
Balance
)
My Nuxt SSR project uses Bulma/Buefy and I am trying to use the #nuxtjs/color-mode module with it
Here is my vars.scss file where I define the light-mode and dark-mode classes
// Import Bulma's core
#import '~bulma/sass/utilities/_all';
$primary-light-color: #0075f2;
$primary-dark-color: #0015f2;
html {
&.light-mode {
--primary-color: #{$primary-light-color};
}
&.dark-mode {
--primary-color: #{$primary-dark-color};
}
}
// Set your colors
$white: #fdfffc;
$black: #272932;
$primary: var(--primary-color);
$primary-invert: findcolorinvert($primary);
$link: #004ba8;
$link-invert: findcolorinvert($link);
$info: #00b4d8;
$info-invert: findcolorinvert($info);
$success: #4cb944;
$success-invert: findcolorinvert($success);
$warning: #ffba08;
$warning-invert: findcolorinvert($warning);
$danger: #f06543;
$danger-invert: findcolorinvert($danger);
$facebook: #3b5998;
$facebook-invert: findcolorinvert($facebook);
$twitter: #4099ff;
$twitter-invert: findcolorinvert($twitter);
$google: #dd4b39;
$google-invert: findcolorinvert($google);
$github: #333;
$github-invert: findcolorinvert($github);
// Setup $colors to use as bulma classes (e.g. 'is-twitter')
$colors: (
'white': (
$white,
$black,
),
'black': (
$black,
$white,
),
'light': (
$light,
$light-invert,
),
'dark': (
$dark,
$dark-invert,
),
'primary': (
$primary,
$primary-invert,
),
'info': (
$info,
$info-invert,
),
'success': (
$success,
$success-invert,
),
'warning': (
$warning,
$warning-invert,
),
'danger': (
$danger,
$danger-invert,
),
'facebook': (
$facebook,
$facebook-invert,
),
'twitter': (
$twitter,
$twitter-invert,
),
'google': (
$google,
$google-invert,
),
'github': (
$github,
$github-invert,
),
);
$navbar-height: 3.5rem;
// https://bulma.io/documentation/components/pagination/#variables
// Removed to make the pagination at the bottom of any table appear without vertical scrollbar
$pagination-margin: 0;
It gives me the following error
ERROR in ./assets/app.scss (./node_modules/css-loader/dist/cjs.js??ref--7-oneOf-1-1!./node_modules/postcss-loader/src??ref--7-oneOf-1-2!./node_modules/sass-loader/dist/cjs.js??ref--7-oneOf-1-3!./node_modules/sass-resources-loader/lib/loader.js??ref--7-oneOf-1-4!./assets/app.scss)
Module build failed (from ./node_modules/sass-loader/dist/cjs.js):
SassError: argument `$color` of `lightness($color)` must be a color
on line 58 of node_modules/bulma/sass/components/message.sass, in function `lightness`
from line 58 of node_modules/bulma/sass/components/message.sass
from line 10 of node_modules/bulma/sass/components/_all.sass
from line 7 of node_modules/bulma/bulma.sass
from line 101 of assets/app.scss
>> $color-lightning: max((100% - lightness($color)) - 2%, 0%);
------------------------------------^
Here is my link to CodeSandbox Can someone kindly tell me how to fix this?
You are passing a var() ($primary: var(--primary-color);) instead of a color (HEX, HSL, RGB, etc).
I ran into a similar problem and got the same Error: SassError: argument '$color' of 'lightness($color)' must be a color.
found out that according to #PirateApp this error occurs because we gave to lightness() method a variable "that references to another variable instead of a color" as an argument.
this means that we can provide a variable as an argument, only if our variable references to a color. So the solution I came up with, is a little trick;
When defining a variable, make it as an adjusted color, instead of referencing to another variable.
so instead of this:
'white': (
$white,
$black,
),
we can write it this way:
'white': (
adjust-hue($white,0deg),
adjust-hue($black,0deg),
),
degmintoradians( degmin( Degrees, Minutes ), radians ) :-
print('test2'),
radians is ((Degrees + Minutes) / 60) * (pi / 180).
distance( Airport1, Airport2, DistanceMiles ) :-
airport( Airport1, _, Latitude1, Longitude1 ),
airport( Airport2, _, Latitude2, Longitude2 ),
print('test1'),
degmintoradians( Latitude1, latrads1 ),
.....
What I'm trying to do is pretty simple, just pass "Latitude1" and "longitude1" into degmintoradians. The print cases are tests, when running the full code, "test1" is printed, however "test2" is not. I can't seem to figure out why, I think I'm doing everything right.
In case it helps, airports are stored in a database like this:
airport( atl, 'Atlanta ', degmin( 33,39 ), degmin( 84,25 ) ).
Thanks.
I am very new in JMP so I am still feeling around.
I want to create a new column called "Status" in JMP. This status is character and depends on the value of the column "Grade". If the value of the entry in column "Grade" is zero, the value of the entry in column "Status" should be "fail". If the "Grade" value is greater than 100, the entry in column "Status" should be "invalid". If the :Grade" value is less than 0, the "Status" value should be "invalid". This should be simple. But somehow, my script won't work:
dt = Current Data Table();
dt << New Column("Status", Character, Formula(
If(:Name( "Grade" )==0, "fail",
:Name( "Grade" )>100, "invalid",
:Name( "Grade" )<0, "invalid")
));
Can you help me debug this script?
I just tried the script and the formula is working for me.
Here is some JSL which is a bit more complete which also adds the "Grade" column upon which "Status" depends.
dt = Current Data Table();
dt << New Column( "Grade",
Numeric,
"Continuous",
Format( "Best", 12 ),
);
dt << New Column( "Status",
Character,
"Nominal",
Formula(
If(
:Grade == 0, "fail",
:Grade > 100, "invalid",
:Grade < 0, "invalid"
)
)
);
Perhaps the issue is that you don't already have a data table opened with a Grade column? Here's a script to create a brand new table with the formula and some values.
New Table( "Grading Test",
Add Rows( 7 ),
New Column( "Grade",
Numeric,
"Continuous",
Format( "Best", 12 ),
Set Selected,
Set Values( [45, 20, 100, 101, -4, 0, 120] )
),
New Column( "Status",
Character,
"Nominal",
Formula(
If(
:Grade == 0, "fail",
:Grade > 100, "invalid",
:Grade < 0, "invalid"
)
)
)
);
I created that by interactively creating the table and using the red-triangle menu and selected "Copy Table Script".
I tried JMP 12.0, which version are you using?