Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
389 views
in Technique[技术] by (71.8m points)

string - R: paste() is changing the order of my characters (some Hebrew)

I am working with a matrix of Hebrew characters. Due to the nature of my problem/data it is important to know when something was not written down, thus a blank is signified by "-", and if something is actually missing data it is signified by "NE" (not extant).

I'm trying to compare the two with the Jaro-Winkler distance so I'm attempting to concatenate each column into its own single string with each entry separated by a space, " ". However when I do this, using paste(data.frame.name$'10',collapse=" ") it returns the string in reverse, first entry is last and last entry is first.

I know I can use stri_inverse from the 'stringi' package as well as other options to fix this. That's no big deal, though I'm still confused why it reverses the string. The other issue is the way it handles "-". While it reverses the rest of the string, if "-" is in the leading or trailing position it doesn't change the position of that character and instead leaves it where it should be. Almost as if treating the "-" separately within paste.

I know Hebrew is read right to left. However is this what is causing this in R? If so how can I remedy the way paste is treating my data or rather how can I concatenate the column into a single string while preserving order?

question from:https://stackoverflow.com/questions/66066259/r-paste-is-changing-the-order-of-my-characters-some-hebrew

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...