Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

R how to not display the number into brackets of the row count in output

Tags:

r

I'm trying to get some (dynamic) R output in a website. For instance, a simple count of some values in a dataframe.

> data(infert)
> length(infert$age)
[1] 248

This "[1]" greatly interferes with the reading :

We do have currently [1] 248 entries in our database

Is it somehow possible to remove this "[1]" line count in front of the shown result, especially when the output is a unique value?

like image 694
Joel.O Avatar asked Sep 11 '25 22:09

Joel.O


1 Answers

Thanks to Ananda's comment below!

cat(length(infert$age))

Does perfectly the trick !

like image 162
Joel.O Avatar answered Sep 14 '25 12:09

Joel.O