I\'m trying to append % sign in the output of prop.table to use in Sweave. My attempted code is below:
prop.table
Sweave
m <- matrix(1:4,2) dimnam
Most functions designed to work with vectors also accept matrices but return a vector instead of a matrix: paste, sprintf, etc. You can use apply, that will return a matrix.
paste
sprintf
apply
apply( prop.table(m,1)*100, 2, function(u) sprintf( "%.1f%%", u ) )