QuickHelper

(10)

$20/per page/

About QuickHelper

Levels Tought:
Elementary,High School,College,University,PHD

Expertise:
Accounting,Applied Sciences See all
Accounting,Applied Sciences,Business & Finance,Chemistry,Engineering,Health & Medical Hide all
Teaching Since: May 2017
Last Sign in: 356 Weeks Ago, 5 Days Ago
Questions Answered: 20103
Tutorials Posted: 20155

Education

  • MBA, PHD
    Phoniex
    Jul-2007 - Jun-2012

Experience

  • Corportae Manager
    ChevronTexaco Corporation
    Feb-2009 - Nov-2016

Category > Accounting Posted 31 Aug 2017 My Price 11.00

Nedd to create function using R

Question description

 

 

Write a function calledlowerTrimthat takes 2 arguments:xandtrimBelow. This function takes the average of those values inxthat are greater than thetrimBelow. Makexa required argument and supply a default value fortrimBelowof negative infinity.

First create some variable to be used for testing later.

x = 1:5
y = letters
z = list(a = 1:5, b = 1:10)

Now test your function with the following

lowerTrim(x)
lowerTrim(-10:5, trimBelow = 0)
lowerTrim(-10:5, -2)
lowerTrim(x = -10:5, trimBelow = Inf)

The return values should be: 3, 3, 2, and NaN, respectively

q2

 

Q2. Extend your function so that it takes a third parameter, which allows the caller to use a function other thanmean()when calculating thelowerTrim. Call this argumentsumFuncand give it a default value so that it operates like the originallowerTrimfunction. Call this revised functionlowerTrim2

Check your function with the following calls:

lowerTrim2(-10:20, trimBelow = -5, median)
lowerTrim2(-10:20, trimBelow = 0, sumFunc = summary)

The return values should be 8 and the summary values of 1, 5.75 10.5, 10.5, 15.2, and 20.

Answers

(10)
Status NEW Posted 31 Aug 2017 08:08 AM My Price 11.00

Hel-----------lo -----------Sir-----------/Ma-----------dam----------- T-----------han-----------k Y-----------ou -----------for----------- us-----------ing----------- ou-----------r w-----------ebs-----------ite----------- an-----------d a-----------cqu-----------isi-----------tio-----------n o-----------f m-----------y p-----------ost-----------ed -----------sol-----------uti-----------on.----------- Pl-----------eas-----------e p-----------ing----------- me----------- on----------- ch-----------at -----------I a-----------m o-----------nli-----------ne -----------or -----------inb-----------ox -----------me -----------a m-----------ess-----------age----------- I -----------wil-----------l

Not Rated(0)