removevars
Remove variables from table or timeseries
Syntax
tout = removevars(tin, vars)
Arguments
- tin
table or timeseries
- vars
a vector of indexes (double), of strings, of booleans or a cell containing strings corresponding to variables in the table or the timeseries
- tout
table or timeseries
Description
tout = removevars(tin, vars) creates tout
from tin
where vars
have been removed.
Examples
Remove variable in table
t = table(["A"; "B"; "C"], [1; 2; 3], [4;5;6], "VariableNames", ["Key", "Value1", "Value2"]) t2 = removevars(t, "Value1") Code = ["AF"; "NA"; "OC"; "AN"; "AS"; "EU"; "SA"]; NameContinent = ["Africa"; "North America"; "Oceania"; "Antarctica"; "Asia"; "Europe"; "South America"]; Area = [30065000; 24256000; 7687000; 13209000; 44579000; 9938000; 17819000]; // in km2 NumberCountry = [54; 23; 14; %nan; 47; 45; 12]; LifeExpectancy = [60; 78; 75; %nan; 72; 75; 74]; // in years t = table(Code, NameContinent, Area, NumberCountry, LifeExpectancy, ... "VariableNames", ["Code", "NameContinent", "Area", "NumberCountry", "LifeExpectancy"]) // remove "Code" and "NumberCountry" variables t2 = removevars(t, [1, 4]) // or use removevars(t, ["Code", "NumberCountry"])
Remove variable in timeseries
ts = timeseries(hours(1:3)', ["A"; "B"; "C"], [1; 2; 3], [4;5;6], "VariableNames", ["Hours", "Key", "Value1", "Value2"]) t2 = removevars(ts, "Value1")
See also
- table — create a table from variables
- timeseries — create a timeseries - table with time as index
History
Версия | Описание |
2025.1.0 | Introduction in Scilab. |
Report an issue | ||
<< readtimeseries | Timeseries/Table | retime >> |