cancel
Showing results for 
Search instead for 
Did you mean: 

Replacing Characters in column names

hoffmanroni
New Contributor III
Hello,


but I'm trying to create my own similar func to replace '$' and '%' characters in the column name instead of removing them.  I've tried this but I'm not sure why I'm getting type error.  Does anyone know?

rndollar:{`$(ssr[x;"$";"Dollar"])each string [x]} 
cleancols:rndollar cols@
cleancols[x] xcol x:table

in table I have a couple columns like "Price $ Change" and "Price % Change" and I want to rename to something like `PriceDollarChange`PricePercentChange

rndollar ("Price $ Change";"Price % Change";"Price")
`type

Thanks!
2 REPLIES 2

pauljloughran
New Contributor
Hi Roni,

It'll work if you tweak your function to something like this:

q)rndollar:{`$ssr[;" $ ";"Dollar"]each string x}
q)rndollar `$("Price $ Change";"Price % Change";"Price")
`PriceDollarChange`Price % Change`Price

Regards,
Paul

Got it.  Thanks very much