tag:blogger.com,1999:blog-4946490806848569840.post2231438050743926742..comments2023-04-24T16:57:22.851-07:00Comments on R snippets: You should not use split in production codeUnknownnoreply@blogger.comBlogger4125tag:blogger.com,1999:blog-4946490806848569840.post-77328889766701352122012-10-14T17:25:03.303-07:002012-10-14T17:25:03.303-07:00For what it's worth, a sep operator was added ...For what it's worth, a sep operator was added to r-devel on June 26 by Brian Ripley in response to a bug report: I'm not sure whether this has made it into a patched/release version yet or not.Ben Bolkerhttp://www.math.mcmaster.ca/bolkernoreply@blogger.comtag:blogger.com,1999:blog-4946490806848569840.post-6045345602631308002012-10-14T08:40:49.095-07:002012-10-14T08:40:49.095-07:00I often use colsplit from the reshape2 package for...I often use colsplit from the reshape2 package for similar tasks. maybe give it a tryJohannes Kutsamhttps://www.blogger.com/profile/06063346141294787875noreply@blogger.comtag:blogger.com,1999:blog-4946490806848569840.post-78464076879131844902012-06-07T08:36:35.288-07:002012-06-07T08:36:35.288-07:00In such a case I would like split at least to acce...In such a case I would like split at least to accept sep parameter exactly like interaction accepts it.<br /><br />I would also like to know an example of the situation when such a behavior is expected. That is - when using split function we would like to have two factors combined like in my exaplme? I was unable to find one - this was the reason for writing of this post.Bogumił Kamińskihttps://www.blogger.com/profile/06250268799809238730noreply@blogger.comtag:blogger.com,1999:blog-4946490806848569840.post-20862401751098267752012-06-07T08:14:21.770-07:002012-06-07T08:14:21.770-07:00You're mistaken. There is nothing wrong with s...You're mistaken. There is nothing wrong with split(). You're just expecting it to behave differently than it was intended. split() was _specifically_ intended to split on the interaction of the list of factors you provide it. So the output you see is exactly correct.<br /><br />The issue is that you want a function that splits sequentially, first by one factor, and then the resulting pieces by the next factor, etc. As you note, there are other functions that do this. So your problem came from misusing split; it simply shouldn't be used in the manner your trying to use it!Anonymousnoreply@blogger.com