Question

Summarizing data 11 Now that youve seen the function sapply() , youll practice writing your own functions to apply! The fir

• Define a character vector named columns that holds the names of the columns trip_distance , total_amount , and passenger_co

1 # Define columns 2 columns <- 3 4 # Create summary function 5 taxis_summary <- function(col, data) { 6 cl 7 mean = 8 sd 9 q

Please help me with writing this code, it's R.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

columns<-c('trip_distance','total_amount','passenger_count')
taxis_summary<-function(col,data){
print(data[col])
c(
mean=mean(data[col]),
sd=sd(data[col]),
quantile(data[col])
)
}

sapply(columns,taxis_summary,taxis)

Add a comment
Know the answer?
Add Answer to:
Please help me with writing this code, it's R. Summarizing data 11 Now that you've seen...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Please give me the R code for the following questions. Create a variable named x1 which...

    Please give me the R code for the following questions. Create a variable named x1 which contains five equally spaced numbers. You may NOT use the c() function to do this. Find the mean of all elements of x1 except the second. Create a list My.List where the first list element is a two-column data frame containing x1 and the vector [2, 1, 4, 7, 8], and the second list element is the logical vector [T, F, NA, T, F]....

  • I need help modifying this code please ASAP using C++ Here is what I missed on this code below Here are the instruction...

    I need help modifying this code please ASAP using C++ Here is what I missed on this code below Here are the instructions Here is the code Produce correct70 pts O pts Full Marks No Marks results and statisfy requirements view longer Comments 1. Your display amount is not readable 2. I withdraw more than my balance, but I didn't see any error message description Documentations10 pts 0 pts Full Marks No Marks : comment i code and block comment...

  • C Programming - Please Help us! Implementing Load Balancing, the 3 Base Code files are at the bot...

    C Programming - Please Help us! Implementing Load Balancing, the 3 Base Code files are at the bottom: Implementing Load Balancing Summary: In this homework, you will be implementing the main muti-threaded logic for doing batch based server load balancing using mutexes Background In this assignment you will write a batch-based load balancer. Consider a server which handles data proces- sing based on user requests. In general, a server has only a fixed set of hardware resources that it can...

  • could you please help me with this problem, also I need a little text so I...

    could you please help me with this problem, also I need a little text so I can understand how you solved the problem? import java.io.File; import java.util.Scanner; /** * This program lists the files in a directory specified by * the user. The user is asked to type in a directory name. * If the name entered by the user is not a directory, a * message is printed and the program ends. */ public class DirectoryList { public static...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT