-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclean_qualtrics_data.m
More file actions
24 lines (20 loc) · 923 Bytes
/
clean_qualtrics_data.m
File metadata and controls
24 lines (20 loc) · 923 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
function [tabout,indices] = clean_qualtrics_data(filein)
% The Function takes in the input as the '.csv' file exported from the
% UPENN-Qualtrics online survey services.
%
% The function has the following data:
% tabout = Output of the form Table.
% indices = Indices where the ID's read a 'NaN' of the form array.
% filein = CSV file name of the form Character Array.
%
% Penn-Qualtrics online service: https://upenn.co1.qualtrics.com/
if ~exist(filein) || (exist(filein) && ~contains(filein,'.csv'))
error('File Not Found');
end, opts = detectImportOptions(filein); opts.MissingRule = 'fill';
dat = readtable(filein,opts);
dat = removevars(dat,{'RecipientLastName','RecipientFirstName',...
'RecipientEmail','ExternalReference','Comments','Email_Topics'});
natime = unique([find(isnat(dat.StartDate));find(isnat(dat.StartDate))]);
dat(natime,:) = [];
indices = find(isnan(dat.WBLID)); tabout = dat;
end