2.2.3.66 wreducerows

Menu Information

Worksheet: Reduce Rows

Brief Information

Reduce worksheet by merging or deleting rows

Additional Information

Minimum Origin Version Required: 9.1 SR0

Command Line Usage

1. wreducerows method:=merge nrows:=3 merge:=ave start:=2;

2. wreducerows method:=hidden;

X-Function Execution Options

Please refer to the page for additional option switches when accessing the x-function from script

Variables

Display
Name
Variable
Name
I/O
and
Type
Default
Value
Description
Input irng

Input

Range

<active>
Specifies the input data range.
Reduce Method method

Input

int

0
Specifies the reduce method.

Option list:

  • 0=del:Delete N rows, then skip M rows
Delete N rows, then skip M rows
  • 1=missing:Delete rows with missing values
Delete the rows with missing values
  • 2=mask:Delete rows with masked values
Delete the rows with masked values
  • 3=merge:Reduce N rows with merged values
Merge every N data points into one data point with specified value.
  • 4=hidden:Delete hidden rows
Delete hidden rows (e.g. filter out data)
Delete Entire Row entire

Input

int

0
Specifies whether to delete rows in irng columns based on missing/masked value , or only delete the missing/masked cells.

This option is only available when Reduce Method is Delete rows with missing values (method=missing) or Delete rows with masked values (method=mask).

Option list:

  • 0=Rows in Selection
Reduce rows by deleting the partial rows in the selected columns (specified by the variable irng)
  • 1=Entire Row of Sheet
Reduce the whole row of input worksheet based on missing/masked value.
  • 2=Cells Only
Ony deleted missing values or masked cells.
Merge/Delete Rows nrows

Input

int

2
Specifies how many rows to merge or delete. This option is only available when selecting Delete N rows, then skip M rows or Reduce N rows with merged values as Reduce Method.
Skip Rows skip

Input

int

1
Specifies how many rows to skip. This option is only available when selecting Delete N rows, then skip M rows as Reduce Method.
Merge by merge

Input

int

0
Specifies the value to replace the merged data points. This option is only available when selecting Reduce N rows with merged values as Reduce Method.

Option list:

  • 0=first:First Point
Replaces N data points with the first value of these datapoints.
  • 1=last:Last Point
Replaces N data points with the last value of these datapoints.
  • 2=ave:Average
Replaces N data points with the average value of these data points.
  • 3=min:Min
Replaces N data points with the minimum value of these data points.
  • 4=max:Max
Replaces N data points with the maximum value of these data points.
  • 5=sum:Sum
Replaces N data points with the sum of these data points.
  • 6=sd:SD
Replaces N data points with the standard deviation of these data points.
Starting Row to Merge/Delete start

Input

int

1
Specifies the starting row to merge/delete.
End Row to Merge/Delete end

Input

int

-1
Specifies the end row to merge/delete. Script accessible only.
Output orng

Output

Range

<input>
Specifies the output range.

Description

This X-Function is used to delete or merge rows with specified statistics data. See also here.

Example

Example 1

  1. Create a new workbook and import the Origin sample data Gaussian Envelope.DAT which is located in <Origin Program Folder> \Samples\Signal Processing.
  2. Highlight all columns, select menu item Worksheet: Reduce Rows to open wreducerows X-Function dialog. Set the options as below:
    Reduce Method: Reduce N rows with merged values
    Merge Rows: 10
    Merge by: First Point
    Starting Row to Merge: 1
    Output: <new>
  3. Click OK to merge the rows.


Example 2

Suppose we have a worksheet data. We want to keep rows where col(B)'s value is bigger than 5000 and delete the rest. Run codes below:

//add a filter to col(B) and hide all rows <5000
wks.col2.filter = 1;
wks.col2.filter$="x>5000";
wks.runfilter();
wks.col2.filter=0;
//delete hidden rows
wreducerows method:=hidden;

Related X-Functions

reducerows, wdelrows


Keywords:data reduction