Hi there! I have a very large (~300,000 by 16) character vector. How could I insert a section that randomly changes, say 1000 of the characters (not lines) to some other character that I define? Thank you!

If you want other characters then you can change the hard-coded 26 and 96 there as appropriate to index into the ascii character set. 26 obviously represents the 26 letters of the alphabet and 'a' is represented by ascii 97. The random integers will be created from 1 to 26 to add to this.

If you want to you can be fussier to ensure that all your 1000 indices are unique also, but I shall leave that for you.

This website uses cookies to improve your user experience, personalize content and ads, and analyze website traffic. By continuing to use this website, you consent to our use of cookies. Please see our Privacy Policy to learn more about cookies and how to change your settings.