Eliminación de valores de celdaHola,
Tengo una tabla similar como se muestra a continuación:
1. La tabla tiene columnas numéricas x_1, x_2, x3, ...
2. Quiero eliminar un valor específico, por ejemplo 8, de todas las filas de cols x_1, x_2, x_3, ... . (La tabla o/p requerida también se muestra a continuación).
Tabla de entrada
| A |
B |
C |
x_1 |
x_2 |
x_3 |
x_4 |
x_5 |
x_6 |
mi |
| |
|
|
1 |
8 |
2 |
7 |
2 |
2 |
|
| |
|
|
2 |
8 |
8 |
8 |
8 |
8 |
|
| |
|
|
8 |
8 |
2 |
5 |
3 |
8 |
|
Tabla de salida requerida
| A |
B |
C |
x_1 |
x_2 |
x_3 |
x_4 |
x_5 |
x_6 |
mi |
| |
|
|
1 |
. |
2 |
7 |
2 |
2 |
|
| |
|
|
2 |
. |
. |
. |
. |
. |
|
| |
|
|
. |
. |
2 |
5 |
3 |
. |
|
Mi guión está adjunto...
Gracias de antemano por la ayuda/comentarios 
dt = Current Data Table ();
for (i=1, i<=6, i++, //iterate through columns loop
temp = "x_" || char (i); //column name
dt << Go To (temp); //select column
dt << Select Where (temp==8);// Select rows where value is 8 ***PROBLEM*** Not selecting rows :(
//After selecting rows where value is 8 for a specific column, I want to delect the value...May be use Empty() ??
);
Re: Borrar valores de celdaAquí hay un cambio muy pequeño al script anterior que hará lo que quieras.
names default to here(1);
dt = open("$SAMPLE_DATA/Big Class.jmp");
// set some height rows to missing
dt:height[6] = .;
dt:height[14] = .;
r = loc(ismissing(dt[0, 4]));
// set the values in column 5(wieght) to missing
// for the rows found(located) in column 4
dt[r, 5] = .;Re: Borrar valores de celdaInteresante.Tengo una necesidad ligeramente diferente de algo como esto.
Digamos que tengo 2 columnas A y B.Se supone que A tiene fecha/hora y B tiene un valor clave.Tengo líneas donde falta la Fecha/hora pero la columna B tiene una clave.
¿Cómo puedo eliminar el valor clave cuando falta la fecha/hora?
Re: Borrar valores de celdaLa subíndice de la tabla de datos también es una opción, en caso de que sea más rápido para su situación.
dt = open("$SAMPLE_DATA/Big Class.jmp");
r = loc(dt[0, 4]==61)
dt[r, 4] = .;Re: Borrar valores de celda¡Muchas gracias!
Estaba pensando en usar un bucle para acceder a las filas de forma iterativa y luego cambiarlo, pero esta es una forma muy buena de usar JSL 
<SPAN class="token function">Column</SPAN><SPAN class="token punctuation">(</SPAN> dt<SPAN class="token punctuation">,</SPAN> ColList<SPAN class="token punctuation">[</SPAN>i<SPAN class="token punctuation">]</SPAN> <SPAN class="token punctuation">)</SPAN><SPAN class="token punctuation">[</SPAN>dt <SPAN class="token operator"><</SPAN><SPAN class="token operator"><</SPAN> get rows where<SPAN class="token punctuation">(</SPAN> <SPAN class="token function">As Column</SPAN><SPAN class="token punctuation">(</SPAN> dt<SPAN class="token punctuation">,</SPAN> ColList<SPAN class="token punctuation">[</SPAN>i<SPAN class="token punctuation">]</SPAN> <SPAN class="token punctuation">)</SPAN> <SPAN class="token operator">==</SPAN> <SPAN class="token number">8</SPAN> <SPAN class="token punctuation">)</SPAN><SPAN class="token punctuation">]</SPAN> <SPAN class="token operator">=</SPAN> <SPAN class="token punctuation">.</SPAN><SPAN class="token punctuation">;</SPAN>
Re: Borrar valores de celdaEstá abordando el problema correctamente, solo tiene algunos problemas de sintaxis.A continuación se muestra una versión de trabajo de su código
Names Default To Here( 1 );
dt = Current Data Table();
// Select the columns to be evaluated
// ColList = {"x_1","x_2","x_3","x_4","x_5","x_6"};
// or if there is a programmatic way to get the list,
// do something like below
ColList = dt << get column names( numeric, string );
// Loop backwards through the list so the "i" index
// maintains it's proper reference
For( i = N Items( ColList ), i >= 1, i--,
If( Left( ColList[i], 2 ) != "x_",
ColList = Remove( ColList, i, 1 )
)
);
// Loop across ColList and set the values qualified
// values to missing
For( i = 1, i <= N Items( ColList ), i++,
// The line below takes advantage of a JMP feature where
// you can change specific values in a column in one statement
// by just using a matrix of the rows you want to change
// Column A[5,6,9,22] = 4;
// This would set a column named "Column A"'s rows 5,6,9 and 22
// to the value of 4
// In your case, you want to eliminate the cell value, so the
// line sets the value to a missing value, which in JMP is "."
Column( dt, ColList[i] )[dt << get rows where( As Column( dt, ColList[i] ) == 8 )] = .;
);