paste

Concatenate rows of a data frame

旧街凉风 提交于 2019-11-27 13:30:00
I would like to take a data frame with characters and numbers, and concatenate all of the elements of the each row into a single string, which would be stored as a single element in a vector. As an example, I make a data frame of letters and numbers, and then I would like to concatenate the first row via the paste function, and hopefully return the value "A1" df <- data.frame(letters = LETTERS[1:5], numbers = 1:5) df ## letters numbers ## 1 A 1 ## 2 B 2 ## 3 C 3 ## 4 D 4 ## 5 E 5 paste(df[1,], sep =".") ## [1] "1" "1" So paste is converting each element of the row into an integer that

How to paste a string on each element of a vector of strings using apply in R?

余生颓废 提交于 2019-11-27 12:17:20
I have a vector of strings. d <- c("Mon","Tues","Wednes","Thurs","Fri","Satur","Sun") for which I want to paste the string "day" on each element of the vector in a way similar to this. week <- apply(d, "day", paste, sep='') No need for apply() , just use paste() : R> d <- c("Mon","Tues","Wednes","Thurs","Fri","Satur","Sun") R> week <- paste(d, "day", sep="") R> week [1] "Monday" "Tuesday" "Wednesday" "Thursday" [4] "Friday" "Saturday" "Sunday" R> Other have already indicated that since paste is vectorised, there is no need to use apply in this case. However, to answer your question: apply is

How to paste on click? It works in google docs

帅比萌擦擦* 提交于 2019-11-27 11:48:35
I want to be able to initiate real paste event when user clicks. I can understand this may be a security issue, because if any webpage had access to users clipboard, that would be bad. So I thought all browsers disallow accessing clipboard data. But for example in google docs (in the word-like application), I can Paste from custom context menu (right mouse click on a html element pretending to be a context menu), even if the clipboard data has been copied to clipboard in different application like Microsoft Paint. This works in Google Chrome browser, which is the browser of my interest. I

Paste Excel Chart into Powerpoint using VBA

泪湿孤枕 提交于 2019-11-27 07:55:02
I'm trying to create an excel macro that copies charts displayed on an excel sheet, and pastes them (paste special) into a PowerPoint. The problem I'm having is how do I paste each chart on a different slide? I do not know the syntax at all.. This is what I have so far (it works but it only pastes to the first sheet): Sub graphics3() Sheets("Chart1").Select ActiveSheet.ChartObjects("Chart1").Activate ActiveChart.ChartArea.Copy Sheets("Graphs").Select range("A1").Select ActiveSheet.Paste With ActiveChart.Parent .Height = 425 ' resize .Width = 645 ' resize .Top = 1 ' reposition .Left = 1 '

Excel VBA: Paste problems

半世苍凉 提交于 2019-11-27 07:05:35
问题 I have tried a variety of ways to do this paste, but none of them are working. I am extremely new to programming, so I need some help with understanding why I keep getting either error 1004 or 5. I don't even understand what these errors mean. Cells(hotcell).Copy Cells.Offset(0, 1).PasteSpecial or ...Paste, ...PasteSpecial = xlpasteall, ...pastespecial Paste:= xlpasteall, Range(Cells("B" & i)).paste, Range("B" & i).paste, and so on as above. I'm at a total loss. Everything else in the program

android paste event

家住魔仙堡 提交于 2019-11-27 06:54:39
问题 Is there a way to catch the paste event in my application? I must do something when I click long on an editText and select Paste from context menu. Thanks 回答1: Create menu.xml with position 'paste' Register contextMenu to your EditText EditText et=(EditText)findViewById(R.id.et); registerForContextMenu(et); Create contextMenu @Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) { MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.menu,

VBA paste range

♀尐吖头ヾ 提交于 2019-11-27 02:55:01
问题 I have simple goal of copying range and pasting it into another spreadsheet . The following code below gives copies, but does not paste. Sub Normalize() Dim Ticker As Range Sheets("Sheet1").Activate Set Ticker = Range(Cells(2, 1), Cells(65, 1)) Ticker.Copy Sheets("Sheet2").Select Cells(1, 1).Activate Ticker.PasteSpecial xlPasteAll End Sub Any suggestions? 回答1: To literally fix your example you would use this: Sub Normalize() Dim Ticker As Range Sheets("Sheet1").Activate Set Ticker = Range

How to paste columns from separate files using bash?

你说的曾经没有我的故事 提交于 2019-11-27 02:02:30
问题 Using the following data: $cat date1.csv Bob,2013-06-03T17:18:07 James,2013-06-03T17:18:07 Kevin,2013-06-03T17:18:07 $cat date2.csv 2012-12-02T18:30:31 2012-12-02T18:28:37 2013-06-01T12:16:05 How can date1.csv and date2.csv files be merged? Output desired: $cat merge-date1-date2.csv Bob,2013-06-03T17:18:07,2012-12-02T18:30:31 James,2013-06-03T17:18:07,2012-12-02T18:28:37 Kevin,2013-06-03T17:18:07,2013-06-01T12:16:05 Please note: the best solution will be able to quickly manage a massive

jquery how to get the pasted content

我们两清 提交于 2019-11-27 01:47:00
问题 I have a little trouble catching a pasted text into my input: <input type="text" id="myid" val="default"> $('#myid').on('paste',function(){ console.log($('#myid').val()); }); console.log shows: default How I catch the pasted text and get ready to use? 回答1: Because the paste event is triggered before the inputs value is updated, the solution is to either: Capture the data from the clipboard instead, as the clipboards data will surely be the same as the data being pasted into the input at that

Jquery / JS bind “paste” event handler to input textbox

我怕爱的太早我们不能终老 提交于 2019-11-27 01:23:25
问题 Allright, SO i have an input box and I need to do things everytime it changes, I am having trouble doing it for mouse paste. Here is the code I have $("#attack-navy"+unit.ID+"-number").bind('paste', function(){ alert("paste detected"); $("#attack-max-capacity").text(getMaxCapacity()); }); the getMaxCapacity() function return number entered * 30 for now; Here is the scenario when 1: I paste 3, it will not change (i still see the alert) 2: Then when i paste 5, it will be 90(3 * 30) 3: Then if i