Use R programming Language
Q1.
(a)Write a function called lowerTrim that takes 2 arguments: x and trimBelow. This function takes the average of those values in x that are greater than the trimBelow. Make x a required argument and supply a default value for trimBelow of 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
(b). Extend your function so that it takes a third parameter, which allows the caller to use a function other than mean() when calculating the lowerTrim. Call this argument sumFunc and give it a default value so that it operates like the original lowerTrim function. Call this revised function lowerTrim2
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.
(c) Modify your function to take in any argument through the ... argument and pass these arguments. Call this new function lowerTrim3.
And test your code with
lowerTrim3(x, sumFunc = sd)
lowerTrim3(-10:20, trimBelow = 0, sumFunc = quantile,
probs = 0.99)
lowerTrim3(-10:20, trimBelow = 0, trim = 0.1)
The results should be 1.58, 19.8, and 10.5.
In: Computer Science
In: Psychology
Silver Company makes a product that is very popular as a Mother’s Day gift. Thus, peak sales occur in May of each year, as shown in the company’s sales budget for the second quarter given below:
| April | May | June | Total | |
| Budgeted sales (all on account) | $300,000 | $500,000 | $200,000 | $1,000,000 |
From past experience, the company has learned that 20% of a month’s sales are collected in the month of sale, another 70% are collected in the month following sale, and the remaining 10% are collected in the second month following sale. Bad debts are negligible and can be ignored. February sales totaled $230,000, and March sales totaled $260,000.
Required:
1. Prepare a schedule of expected cash collections from sales, by month and in total, for the second quarter.
2. What is the accounts receivable balance on June 30th?
In: Accounting
In: Computer Science
For Problems 1–4, using the STORES Database, formulate SQL queries, Hand in a listing of each query and its output.
1. (10 Points) For each customer, list each stock item ordered, the manufacturer, the quantity ordered, and the total price paid. Include the following columns in the order given below:
From Customer Table: Company
From Stock Table: Description
From the Manufact Table: Manu_Name
From the Items Table: Quantity, Total Price
Order the output by Company and Description.
2. (10 Points) List all orders with a shipping date between December 25, 1999 and January 5, 2000. List the Order Number, Order Date, Customer company name, and Shipping Date. Order by Customer Company Name and Order Number.
3. (10 Points) Count the number of customers who do not have any orders placed.
4. (10 Points) List all customers who are ordering equipment whose description begins with ‘tennis’ or ‘volleyball’. List the Customer number, Stock number, and Description. Do not repeat any rows.
5. (15 Points) Use the following SQL CREATE commands to CREATE the following tables in your
User ID:
CREATE TABLE Professor
(Prof_ID NUMBER(3) Constraint pk_Professor Primary Key,
Prof_Lname VARCHAR2(15) NOT NULL,
Prof_Hiredate DATE,
Prof_Sal NUMBER(8,2),
Prof_Dept CHAR(6)
);
CREATE TABLE Student
(Stu_ID NUMBER(4) Constraint pk_Student Primary Key,
Stu_Lname VARCHAR2(15) NOT NULL,
Stu_Major CHAR(6),
Stu_CredHrs NUMBER(4),
Stu_GradePts NUMBER(5),
Prof_ID NUMBER(3),
CONSTRAINT fk_Student_Prof_ID FOREIGN KEY(Prof_ID)
REFERENCES Professor
);
Hand in: Print out of the Create commands, the system response and a DESCRIBE of the tables.
6. (15 Points) Insert the following data into the tables created above using SQL INSERT commands.
Professor Table:
|
Prof_ID |
Prof_Lname |
Prof_Hiredate |
Prof_Sal |
Prof_Dept |
|
123 |
Hilbert |
20-MAY-1992 |
58000.00 |
MATH |
|
243 |
Newell |
15-JUL-1997 |
65500.00 |
CMPSCI |
|
389 |
Lessing |
04-APR-1988 |
40250.00 |
ENG |
Student Table:
|
Stu_ID |
Stu_Lname |
Stu_Major |
Stu_CredHrs |
Stu_GradePts |
Prof_ID |
|
2001 |
Parker |
CMPSCI |
52 |
160 |
243 |
|
2166 |
Smith |
ENG |
30 |
75 |
389 |
|
3200 |
Garcia |
MATH |
62 |
248 |
123 |
|
4520 |
Smith |
CMPSCI |
45 |
157 |
NULL |
In: Computer Science
Hi, can you answer this question in more detail?
Subject: Quality Management and Practices
8.
Research on the current state of Toyota's Company quality management covers the following topics, demonstrate your theoretical understanding and skills in evaluating existing operational management issues, and use a quality management framework for analysis.
• Total Quality Management…
( Words: 900 - Need to be original, Don't direct copy )
In: Operations Management
Feminism promotes equality between men and women, and argues that we must address historical power imbalances in order to bring about such equality. Intersectional feminism builds on this idea, but recognizes that gender is not the only source of privilege or oppression: race, class, nationality, sexual orientation, disability status, etc. are other factors. We have complex identities, and a person can be privileged in some ways, but oppressed in others. Thus, intersectional feminism brings greater nuance to the quest for equality.
What are some possible benefits and drawbacks of using the concept of “intersectionality” to analyze literature? How might this concept help us better understand the themes or characters of a work?
In: Psychology
2. Describe three ways in which the visual system compensates for aspects of the visual stimulus to give us perceptions of a stable, real physical world.
3. What does it mean to assume that the mind is modular? Make sure to clearly distinguish this view from the view that processing structures in the brain are domain general. What evidence supports the modular view and what evidence undermines it?
4. What is difference between bottom-up and top-down processing? Describe in detail an example of each from the theories of visual pattern recognition.
5. What is the difference between an early selection model of attention and a late selection model of attention? Describe an example of each kind of model, including discussing what makes it a model of that type.
In: Psychology
A 2.49-kg cart on a long, level, low-friction track is heading for a small electric fan at 0.25 m/s . The fan, which was initially off, is turned on. As the fan speeds up, the magnitude of the force it exerts on the cart is given by at2, where a = 0.0200 N/s2.
Part A
What is the speed of the cart 3.5 s after the fan is turned on?
Part B
After how many seconds is the cart's velocity zero?
In: Physics
Develop a simple point-to-point Message communication system(Java Message Service) using ActiveMQ. Provide the necessary code.
In: Computer Science
Using C++,
Write a program that will use pointer syntax to access variables, dynamically allocate memories, and pass pointers to functions.
1. The program should ask the user to enter a size to the array.
2. The program should dynamically allocate an array with the size.
3. The program should then ask user to input values to the array
4. The program should then find the maximum, display all elements forward and reversed using two different ways of pointer access
5. The program must use functions with pointers as parameters.
6. The manipulation/access of the array must be done through pointer syntax.
7. Your main function should only declare the variables and call the functions.
Variable:
You’ll need the following pointer to be declared in your main function.
float * ptData;
Data Validation:
1. The size of the array cannot be less or equal to 1 (E.g. 2, 5, 100 is fine, but 1 or 0 is no acceptable).
2. Check if pointer has successfully allocated the array.
Functions:
You should have separate functions to handle user input, maximum, and display the array (all the values needs to be returned to the function call, you need to have pointer as the input parameter). Main function should only call other functions.
|
Function Header |
Explanation |
|
void getSize(int * ptr) |
This function will ask user to enter a size to the array. The size of the array cannot be less or equal to 1. For example: 2, 5, 100 is fine, but 1 or 0 is no acceptable. |
|
float * getValues(const int SIZE) |
This function will declare and use a pointer to dynamically allocate an array with the size user has entered. The pointer should be returned to the function’s call. Check if pointer has successfully allocated the array. |
|
float getMax(const float * ptr, const int SIZE) |
This function will find and return the maximum value of the array using pointer syntax. |
|
void displayForward(const float * ptr, const int SIZE) |
This function should display all array elements forward (from the first to the last) |
|
void displayBackward(float * const ptr, const int SIZE) |
This function should display all array elements backward (from last to the first) You are required to use the following pointer and loop to accomplish this task. float * ptr2 = ptr + SIZE; while (ptr < ptr2) |
Sample Output:
|
Please enter a size to the array: -9 !!!Error: an array’s size cannot be less or equal to 1 Please enter a size to the array: 6 Please enter all values of the array: Value 1: 4 Value 2: 5 Value 3: 7 Value 4: 2 Value 5: 1 Value 6: 8 Displaying all values forward: 4 5 7 2 1 8 Displaying all values backward: 8 1 2 7 5 4 The maximum value of this array is: 8 |
In: Computer Science
4. Forty-three milliliters of 0.130 M nitric acid is added to 30.0 mL of 0.095 M calcium hydroxide. Calculate the pH of the initial nitric acid solution and then calculate the pH of the combined solutions. Assume the solution volumes are additive. Hint: determine whether excess H+ or OH- remain in solution after neutralization, then calculate the pH.
Show all steps please to help me understand, thank you!
In: Chemistry
For each of the situations described below, select the type of analytics that would address the specific organizational need and justify your selection.
b. A large retail chain wants to understand what factors contributed to the overall sales decline it experienced in a specific month in the past.
c. To support staffing analysis for a holiday season, a clothing store wants to improve its understanding of the number of customers that are likely to visit each of its stores during the November 15–January 15 time frame.
d. A gaming company wants to provide all of its employees an up-to-date graphical representation of the number of downloads of its game products and in-app revenue associated with them.
In: Operations Management
You are the owner of Smalltown Computer, a local computer repair store that also assembles custom computers to order. The company has been very successful and is growing exponentially. However, the company is having difficulty preparing for future growth. The only information system the company has is an accounting system.
In: Operations Management
1. List and explain at least two forces of the external environment (General or Industry) that are causing all companies --not just Volkswagen-- to become more sensitive to environmental issues.
2. Before the scandal, what was Volkswagen's apparent position on the environment, and what did the company do to ensure that stakeholders (i.e., customers, employees, society) knew this position?
-List at least two ways in which VW communicated this stance to stakeholders
3. Based on the industry forces, describe the nature of competition in the global automobile industry and explain the reasons for this rivalry.
To what extent do you think competition led to the Volkswagen scandal?
4. Describe two (2) of Volkswagen's responses to the allegations.
In: Operations Management