I upload a CSV file that looks like this in JavaScript:
user_id, aligned_audio_onset_sec, x, y
1, 1.3 , 0.3, 0.5
1, 5, 0.9, 0.3
3, 4, 0.5, 0.5
With this script:
$(function() {
var VAdata = $.get("./VAdata.data", function(data) {
VAdata = data.split(/\r?\n/).map(pair => pair.split(/,/).map(Number));
$('#log').text(JSON.stringify(VAdata));
});
});
It works well, except that it does not ignore the headers, but I cannot figure out how to do this. I was also wondering if I can check to see if all lines are 4 in length and delete those that don't. (I can only think of copying line by line and only including full-length copy.)
Log outputs:
[[null,null,null,null],[1,1.3,0.3,0.5],[1,5,0.9,0.3],[3,4,0.5,0.5],[0]]