Hello all,
I'm trying to manipulate my column names. It's very easy to do once or twice with Find/Replace but I'd like to script it.
Essentially, I want to change a column name from "Singlets/Live leukocytes/Lymphocytes/B cells/A+B+C-,Freq. of Parent" to "B cells/A+B+C-,Freq. of Parent".
Here is my current code:
dt = Current Data Table ();
colList = dt << get column names(string);
For ( i = 1, i <= N Items(colList), i++,
If (
contains(colList[i], "Singlets/Live leukocytes/Lymphocytes/"),
Column(dt, colList[i]) << set name (Word(2, colList[i], "Lymphocytes/"))
));
If I run parts of this code individually, here's what I get:
line of code:
result in script log
colList[i]:
"Singlets/Live leukocytes/Lymphocytes/B cells/A+B+C-,Freq. of Parent"
contains(colList[i], "Singlets/Live leukocytes/Lymphocytes/"):
1
Word(2, colList[i], "Lymphocytes/"):
"iv"
Word(3, colList[i], "Lymphocytes/"):
" l"
Word(4, colList[i], "Lymphocytes/"):
"uk"
Word(9, colList[i], "Lymphocytes/"):
"f Par"
Clearly, my delimiter isn't working the way I expect it to. Any ideas?
I originally tried to do Words(4, colList[i], "/") but that only gave me "B cells" since there is another / immediately after that. Unlike other programming languages, I don't know if there is a way to specify '4th word and then everything afterwards until the end' in JSL. I don't think this is possible so I changed the delimiter, thinking that would solve my problem.
Thanks so much for any advice!!