[R] how to get R to print only one column per line when outputting a matrix?
Godmar Back
godmar at gmail.com
Tue Jul 7 19:28:19 CEST 2009
On Tue, Jul 7, 2009 at 1:22 PM, Godmar Back<godmar at gmail.com> wrote:
>
>> apply(AA, c(2,1), cat, "\n")
> Error in cat(list(...), file, sep, fill, labels, append) :
> argument 1 (type 'list') cannot be handled by 'cat'
>
ps: but your idea of using 'apply' led me to this:
> dummy <- apply(AA, c(2), function (r) { cat(sprintf("%f - %s\n", r[2], format(r[1]))) })
0.744064 - overallimpression
0.727025 - yourinitialimpression
0.555020 - managementprocess_as_ord
[...]
which is exactly what I'd like.
Thanks!
- Godmar
More information about the R-help
mailing list