How to hide the default column numbers in R while showing output


#1

Hi All,

In genral when we load dataset defalut column will generate with our data in R

LIke this

head(iris)
Sepal.Length Sepal.Width Petal.Length Petal.Width Species
1 5.1 3.5 1.4 0.2 setosa
2 4.9 3.0 1.4 0.2 setosa
3 4.7 3.2 1.3 0.2 setosa
4 4.6 3.1 1.5 0.2 setosa
5 5.0 3.6 1.4 0.2 setosa
6 5.4 3.9 1.7 0.4 setosa

But i need the results like this In R

Sepal.Length Sepal.Width Petal.Length Petal.Width Species
5.1 3.5 1.4 0.2 setosa
4.9 3.0 1.4 0.2 setosa
4.7 3.2 1.3 0.2 setosa
4.6 3.1 1.5 0.2 setosa
5.0 3.6 1.4 0.2 setosa
5.4 3.9 1.7 0.4 setosa

using write.csv i can do with the row.names=FALSE while exporting
but i want to see the reults in R also how can we do can any one suggest on this


#2

Hello @raghava_r4u,

If you just want to see the data frame in R console without the row names/numbers you can try this

print(head(iris),row.names=F)
Sepal.Length Sepal.Width Petal.Length Petal.Width Species
5.1 3.5 1.4 0.2 setosa
4.9 3.0 1.4 0.2 setosa
4.7 3.2 1.3 0.2 setosa
4.6 3.1 1.5 0.2 setosa
5.0 3.6 1.4 0.2 setosa
5.4 3.9 1.7 0.4 setosa

Hope this is what you wanted to do.


#3

Hi @adityashrm21

apologize for late reply

Yes this is what i want to do ,Thank you so much .