mirror of
https://github.com/jspsych/jsPsych.git
synced 2025-05-10 19:20:55 +00:00
Update packages/jspsych/src/modules/data/DataCollection.ts
Co-authored-by: bjoluc <mail@bjoluc.de>
This commit is contained in:
parent
cafc6a1f65
commit
9180ab9671
@ -135,14 +135,11 @@ export class DataCollection {
|
||||
}
|
||||
|
||||
filterColumns(columns: Array<string>) {
|
||||
const filtered_data = [];
|
||||
for (const trial of this.trials) {
|
||||
const filtered_columns = Object.fromEntries(
|
||||
columns.filter((key) => key in trial).map((key) => [key, trial[key]])
|
||||
return new DataCollection(
|
||||
this.trials.map((trial) =>
|
||||
Object.fromEntries(columns.filter((key) => key in trial).map((key) => [key, trial[key]]))
|
||||
)
|
||||
);
|
||||
filtered_data.push(filtered_columns);
|
||||
}
|
||||
return new DataCollection(filtered_data);
|
||||
}
|
||||
|
||||
select(column) {
|
||||
|
Loading…
Reference in New Issue
Block a user