paste

Split a character vector into individual characters? (opposite of paste or stringr::str_c)

吃可爱长大的小学妹 提交于 2019-12-27 12:08:13
问题 An incredibly basic question in R yet the solution isn't clear. How to split a vector of character into its individual characters, i.e. the opposite of paste(..., sep='') or stringr::str_c() ? Anything less clunky than this: sapply(1:26, function(i) { substr("ABCDEFGHIJKLMNOPQRSTUVWXYZ",i,i) } ) "A" "B" "C" "D" "E" "F" "G" "H" "I" "J" "K" "L" "M" "N" "O" "P" "Q" "R" "S" "T" "U" "V" "W" "X" "Y" "Z" Can it be done otherwise, e.g. with strsplit() , stringr::* or anything else? 回答1: Yes, strsplit

Exclude a column when pasting two data files

北慕城南 提交于 2019-12-25 10:37:04
问题 I have one file "dat1.txt" which is like: 0 5.71159e-01 1 1.92632e-01 2 -4.73603e-01 and another file "dat2.txt" which is: 0 5.19105e-01 1 2.29702e-01 2 -3.05675e-01 to write combine these two files into one I use paste dat1.txt dat2.txt > data.txt But I do not want the 1st column of the 2nd file in the output file. How do I modify the unix command? 回答1: paste dat1.txt <(cut -d" " -f2- dat2.txt) Using cut to remove column 1, and using process substitution to use its output in paste Output: 0

Exclude a column when pasting two data files

别说谁变了你拦得住时间么 提交于 2019-12-25 10:36:04
问题 I have one file "dat1.txt" which is like: 0 5.71159e-01 1 1.92632e-01 2 -4.73603e-01 and another file "dat2.txt" which is: 0 5.19105e-01 1 2.29702e-01 2 -3.05675e-01 to write combine these two files into one I use paste dat1.txt dat2.txt > data.txt But I do not want the 1st column of the 2nd file in the output file. How do I modify the unix command? 回答1: paste dat1.txt <(cut -d" " -f2- dat2.txt) Using cut to remove column 1, and using process substitution to use its output in paste Output: 0

Override iPhone copy menu captions on a long-press?

房东的猫 提交于 2019-12-25 04:55:29
问题 Is it possible to override the captions in the "Copy" menu when the iphone user long-presses on some text? Essentially, I'd like to change the text to something like "Create a Note" instead of "Copy". Is that possible? 回答1: You can add custom menus via UIMenuController's menuItems property, something like: UIMenuItem* item1 = [[UIMenuItem alloc] initWithTitle:@"One" action:@selector(DoThingOne:)]; UIMenuItem* item2 = [[UIMenuItem alloc] initWithTitle:@"Two" action:@selector(DoThingTwo:)];

Paste formatted Excel range into Outlook task

僤鯓⒐⒋嵵緔 提交于 2019-12-25 02:59:46
问题 I've been trying to create a sub that would take some information from an Excel selection and create a new task on Outlook. The body of the task should feature the comment from the first cell (which it already does) but before all that I want to paste the range as it looks in Excel, then the comment, and then again, the range. Here's my code: Sub CreateReminder() Dim olApp As Object Dim olRem As Object Dim myRange As Range Dim contact As String Dim company As String Dim city As String Dim

Copy cell J1 from multiple files and paste into column of masterfile

人盡茶涼 提交于 2019-12-25 02:44:40
问题 I currently have this code which will take files from a folder, open each one, print its name into the first column of my "Master file" close it and loop through the entire folder that way. In each file that is opened, there is information in cell J1 that I would like to copy and paste into column 3 of my "master file". The code works but will only paste the desired info from J1 into C2 over and over so the information keeps being written over. I need to increment down the list so the info

How copy image from directory (folder) to RichTextBox in WPF?

本秂侑毒 提交于 2019-12-24 18:15:14
问题 I have RichTextBox in WPF . I can copy and paste (drag&drop) images from Web Sites and from Windows Photo Viewer . But If i try to copy image from directory I'll can't paste in my RichTextBox But if I create a special button to paste image from directory it will work: private void Button_Click(object sender, RoutedEventArgs e) { string[] files = (string[])Clipboard.GetData(DataFormats.FileDrop); if (files != null && files.Length > 0) { foreach (var file in files) { // Filter out non-image

How to set max byte length of datagridview when paste

蹲街弑〆低调 提交于 2019-12-24 17:57:05
问题 I have a datagridview where DataNames can be entered in a textbox column.I restrict the input length of this column to 6 characters by using the MaxInputLength property of the DataGridViewTextBoxColumn . Here, I want to explain my problem step by step. 1 . I wrote Double Byte Characters(eg.1234567890) on a notepad and copy it.Then I went to this DataGridViewTextBox ,Right Click and then choosed Paste .The DataGridViewTextBox showed 123456. 2 .I wrote Double Byte Characters(eg.123456) on a

Paste event modify content and return it at the same place

纵然是瞬间 提交于 2019-12-24 15:14:46
问题 I have created this jsfiddle for try to explain what Im trying to do http://jsfiddle.net/nonyck/tyyCN/ $('.autoresize').bind('paste', function(e) { e.preventDefault(); var data = e.originalEvent.clipboardData.getData('text'); if(data.match("http://.*?.(jpg|png|gif)")) { $('.autoresize').val($('.autoresize').val() + "<image src='" + data + "' >"); } else { $('.autoresize').val( $('.autoresize').val() + data); } }); What Im trying is to get the paste event, then modify it and return it back

Collapsing character vectors with sprintf instead of paste

微笑、不失礼 提交于 2019-12-24 08:13:31
问题 I have mostly used paste or paste0 for my pasting tasks in the past, but I'm pretty fascinated by the speed of sprintf . Yet I feel that I'm lacking some its basics. Just wondered if there's also a way to collapse a multi-element character vector to one of length 1 as paste would do when using its collapse argument, that is, without having to specify respective wildcards and its values manually (in paste , I simply leave the task up to the function to find out how many elements should be