dplyr dataset not able to view

view(iris) ..... code not given result
mean(iris$Sepal.Length) .... got result
iris %>% mean(Sepal.Length) .... No result
pls advise...

mean() expects a vector, not a data frame, You can use

iris$Sepal.Length %>% mean()
or
iris %>% pull(Sepal.Length) %>% mean()
or
iris %>% summarise(mean(Sepal.Length))

1 Like

Hi @manikandan_ramaraj, when you use View() is with upper V. You have v, view().

# try:
library(ggplot2)
View(iris) # must show df 
view(iris) # dont show anything. Its not a function.
1 Like

The view() function is part of the tibble package. It simply calls the View() function.

If you load the tidyverse package, then tibble will also be loaded. If you just load selected tidyverse packages, such as dplyr or ggplot2, you will need to run library(tibble) or use tibble::view().

library(ggplot2)
library(tibble)
view(iris)  # gives same result as View(iris)
1 Like

Hi,
Thanks for replying me.... still it is not working....i am not able to add screenshot thru upload in this section.
when i upload it becomes link as below...pls advise

Hi ,
sorry... when i give ok to the tab i am able to view the screenshot in the section

Thanks,

Hi.....

now it is working.... given result

Thanks......!!! replying me.
. i am not able get results... below the attached

Thanks... i!!
i will load tibble package

Thanks,,,,, for supporting

Thanks... for the support

The function "%>%" (the magrittr "pipe") won't be available unless you first run library(tidyverse) (or any other package that supplies it), so you can do that, or you can replace the magrittr pipe with the base pipe, which is always available:

 iris$Sepal.Length |> mean()
2 Likes

Thanks.....for your support

Thanks....for your support

Thanks... for the support

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.