Why nrow function doesn t seem to work within summarise function

0 votes
See the code below:

library(dslabs) \sdata(gapminder)
gapminder percent > percent group by(year) percent > percent summarise(weight = nrow(population)) percent > percent filter(year percent in percent c(2010, 2015) &!is.na(population))

I keep getting the message, "Column weight is of unsupported type NULL," why?

Population is a vector inside the summarise() function, which is what nrow() expects as a parameter. I therefore wonder why it doesn't.

Note: I am not searching for workable substitutes for nrow() because I am aware of its alternatives in this situation. My query is philosophical and is focused on the word "Why."
Jun 27, 2022 in Data Analytics by avinash
• 1,840 points
355 views

No answer to this question. Be the first to respond.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.

Related Questions In Data Analytics

0 votes
1 answer

How to set choices of inputs within server function in shiny app?

@Kajal, Use renderUI function to add input elements ...READ MORE

answered Oct 28, 2019 in Data Analytics by anonymous
• 33,030 points
673 views
0 votes
0 answers

pass character strings to ggplot2 within a function

In order to streamline my work process, ...READ MORE

Jun 24, 2022 in Data Analytics by Avinash
• 1,260 points
541 views
0 votes
1 answer

Using "dplyr" to summarise multiple columns

You can use the "sumamrise_all()" function for ...READ MORE

answered Mar 27, 2018 in Data Analytics by Bharani
• 4,660 points
1,654 views
+1 vote
2 answers

Custom Function to replace missing values in a vector with the mean of values

Try this. lapply(a,function(x){ifelse(is.na(x),mean(a,na.rm = TRUE ...READ MORE

answered Aug 14, 2019 in Data Analytics by anonymous
1,976 views
0 votes
1 answer
0 votes
1 answer

How to apply list to a function which give data frame as output

If you use  tidyverse, you can use ...READ MORE

answered Apr 11, 2018 in Data Analytics by Sahiti
• 6,370 points
847 views
0 votes
1 answer

Big Data transformations with R

Dear Koushik, Hope you are doing great. You can ...READ MORE

answered Dec 18, 2017 in Data Analytics by Sudhir
• 1,570 points
1,047 views
0 votes
2 answers

Transforming a key/value string into distinct rows in R

We would start off by loading the ...READ MORE

answered Mar 26, 2018 in Data Analytics by Bharani
• 4,660 points
1,224 views
0 votes
1 answer

Finding frequency of observations in R

You can use the "dplyr" package to ...READ MORE

answered Mar 26, 2018 in Data Analytics by Bharani
• 4,660 points
5,909 views
0 votes
1 answer

Left Join and Right Join using "dplyr"

The below is the code to perform ...READ MORE

answered Mar 27, 2018 in Data Analytics by Bharani
• 4,660 points
1,157 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP