R: paste() won't concatenate but only repeats the original vector instead

ساخت وبلاگ

Vote count: 0

I was reading the book "Text Analysis with R for Students of Literature" and trying to reproduce the example. Therefore I have a vector in which every element is one line of text from a book and I am now attempting to merge these into a vector of the length one with the past() function. I have tried to play around with the arguments and read about it but no matter what, the resulting vector keeps the original length. I am using R studio 0.99.484 with R 3.2.3 on a linuxMint 17.2, in case that makes a difference.

This is my reproducible example

 > a <- rep("blabla", 5) > b <- paste(a, colapse= "X") > b [1] "blabla X" "blabla X" "blabla X" "blabla X" "blabla X" > length(b) [1] 5

The way I understand the documentation, I would expect the results be more like "blablaXbla... and the length have a value of 1.

Thanks for your help.

asked 1 min ago

back soft...
ما را در سایت back soft دنبال می کنید

برچسب : نویسنده : استخدام کار backsoft بازدید : 309 تاريخ : شنبه 29 اسفند 1394 ساعت: 17:11