-
Notifications
You must be signed in to change notification settings - Fork 76
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Could we possibly add a ssv() or wssv()? #70
Comments
You can make your own using |
thank you. Can it do the fetch as well? Would it be: d3.text("data.txt")
.then(txt => ssv.parse(txt))
.then(data => {
}); ? Seems like it can't. Seems like it needs to be: ssv = d3.dsvFormat("\t ");
d3.text("multiple.tsv")
.then(txt => {
data = ssv.parse(txt)
console.log(data); but it seems 3 \t 4 (some space and a tab) it is not possible to work this way? But if it is: ssv = d3.dsvFormat(" ");
d3.text("multiple.tsv")
.then(txt => {
txt = txt.replace(/[\t ]+/g, " ");
data = ssv.parse(txt);
console.log(data); then it can work. |
d3.dsvFormat only allows characters as delimiters; it doesn’t support multiple characters or regular expressions as delimiters. You can use space as a delimiter, or tab, but not both. To fetch and parse a file: d3.text(url).then(text => ssv.parse(text)) Added examples here: |
I appreciate it. I was trying to replicate the case with spaces in front of the first value and this seems to work ok: ssv = d3.dsvFormat(" ")
d3.text("multiple.ssv")
.then(txt => {
txt = txt.replace(/[\t ]+/g, " ").replace(/^[ ]/gm, "").replace(/[ ]$/gm, "");
data = ssv.parse(txt);
console.log(data); |
Besides fetching data by
tsv()
andcsv()
, could we supportssv()
orwssv()
for whitespace separated values?For example, if the data is
the data is quite well formatted and readable by human, and it also can be considered ok to be proper data and processed by a program. For files such as
it the data is not nicely formatted, but if a human can understand it, can it be also be allowed to be processed by the program as well.
The following can preprocess the second form:
The text was updated successfully, but these errors were encountered: