This is a pretty simple question but I can't seem to work out how to do it! Suppose I have a vector vec = c(1,2,3,4,5). I want R to output to the console something like "Iteration 10 : (1,2,3,4,5)" or "Iteration 10 : 1,2,3,4,5". Basically I want the vector to be listed on a single line without stupid spacing. If I do paste("Iteration 10 : ",vec) then I get Iteration 10 : 1 Iteration 10 : 2 Iteration 10 : 3 Iteration 10 : 4 Iteration 10 : 5 No combination of putting c( ) around things seems to help. Putting it all inside a print( ) doesn't help. Using list(1,2,3,4,5) makes the layout nicer but it is not all on one line or it gives a large gap between the text string and the vector components. How do I do it? No doubt its embarrassingly simple but R's love of combining vectors and shuffling between arrays and vectors is not entirely second nature to me yet. By the way, for the moderators, this is the second thread I've started recently and each time I'm unable to post it if I try a title which isn't very short. For instance, I couldn't post this with the title "Basic R question" or "R question" or "Question about R". That's why my thread about Magneto has such a short title too.
Maybe instead of using R you should use 1/R? Please Register or Log in to view the hidden image! . Just kidding
You mean \(\frac{1}{\mathbb{R}^{N}}\), just ask Magneto Please Register or Log in to view the hidden image!. I've managed to botch something a little better using lists but the spacing between elements in the vector is always the size of the large spacing so the gap between 2 and 3 is the size of the string 'iterations'. gah! Perhaps I'm spoilt with Mathematica's lots of nice pretty inbuilt layout functions.
I'm just learning python 3 right now, I hope to use it in conjunction with some 3rd party sampling eventually. Apparantly it's good for biology and we do end up with endless lists of data to process. If i find any scripts I think will help, I'll let you know. The developers claim this will run on any system, we'll see. I've gone for a new 64bit version and feel like I'm back in school again Arrrgh!!
I'm pretty sure you want something like this: paste("Iteration 10 : ", paste(vec, sep=",")) Paste "recycles" its arguments. so that all vectors seem the same length.
That unfortunately gives me what I mentioned in my first post, I get Iteration 10 : [number] for each component of vec. I think there's some way of doing it using data tables, as each column has labels and you can have strings as entries but that's not terribly convenient for iterative updates, rather than collating information at the end.
Whoops. Re-read the manual including the footnote. paste("Iteration 10 : ", paste(vec, collapse=","), collapse=" ")
Hurray!!! I knew R must be able to do it somehow!! In Mathematica it is just print["Interation 10 : ",vec] . Unfortunately R isn't as intuitive. Thanks very much Please Register or Log in to view the hidden image!