I have function that processes some data and I would like to print the intermediate steps while the function (a loop) proceeds. I could do that in 1 point where the updated data is all in one data.frame()
. I'm thinking of some simple table as for example I saw as part of Rapporter tool box.
So the question is how or whether it is possible to print table with numerical values into console.
Thanks.
EDIT: print()
is not the solution I'm after and here is why:
function print()
prints the numeric values into console, but its a messy bunch of numbers. I would like to have kind of table to easily check the values while the function proceeds. So I can better orientate in the numeric values.
Something like this?
require(knitr)
for(i in 1:2){
#some calculation
x<-runif(runif(1,1,5))
y<-length(x)
#dataframe output
df <- cbind(x,y)
#pretty table
print(kable(df))
}
#output
# | x| y|
# |---------:|--:|
# | 0.4872941| 3|
# | 0.8014921| 3|
# | 0.7023384| 3|
#
#
# | x| y|
# |---------:|--:|
# | 0.9214315| 4|
# | 0.7119830| 4|
# | 0.0354769| 4|
# | 0.1049139| 4|
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With