Consider a data having the form
data={{P,4,3,2},{V,7,8,9,55},{P,19,3,4},{V,48,6,1,55}}
How to remove all rows with V and then to remove the first column, i.e., to get
dataprime={{4,3,2},{19,3,4}}
DeleteCases[data, {V, ___}][[All, 2 ;;]]
{{4, 3, 2}, {19, 3, 4}}
data = {{P, 4, 3, 2}, {V, 7, 8, 9, 55}, {P, 19, 3, 4}, {V, 48, 6, 1, 55}};
Two other possibilities
Cases[data, {P, a__} :> {a}]
{{4, 3, 2}, {19, 3, 4}}
Rest @@@ SequenceSplit[data, {{V, __}}]
{{4, 3, 2}, {19, 3, 4}}
data = {{P, 4, 3, 2}, {V, 7, 8, 9, 55}, {P, 19, 3, 4}, {V, 48, 6, 1, 55}};
Using SequenceCases
:
SequenceCases[data, {s : {P, __}} :> Rest@s]
(*{4, 3, 2}, {19, 3, 4}}*)
Or using ReplaceList
:
ReplaceList[data, {___, s : {P, __}, ___} :> Rest@s]
(*{4, 3, 2}, {19, 3, 4}}*)
data = {{P, 4, 3, 2}, {V, 7, 8, 9, 55}, {P, 19, 3, 4}, {V, 48, 6, 1, 55}}
Using Select
:
data // Select[First@# =!= V &] // Map[Rest]
Using Pick
:
Rest /@ Pick[data, First@# =!= V & /@ data]
Result:
{{4, 3, 2}, {19, 3, 4}}
Cases[data, {Except[V], rest__} :> {rest}]
$\endgroup$