Регистрация
Среда программирования: Язык программирования R
Название работы: Задачи на языке программирования R
Вид работы: Программа
Описание: Задачи на языке программирования R.
Assignment no. 1 Introduction to R 365.079 (2KV) — SS 2017
Exercise 1 (10 points) Download the file Exercise1.R which contains a function qFunc1(x).
Replace lines 6–22 of this function by a single-line expression that only uses basic matrix operations.
(no apply-like function!) Test your new function properly to ensure that your function
behaves exactly like qFunc1(). Please do not forget proper NA handling and also consider missing values when testing your function. Provide a few lines of arguments in favor of your solution and also submit the source code and results of your tests.
Exercise 2 (10 points) Write an R function tridiagonalSum(A) that takes a quadratic numeric matrix A and computes the sum of all elements that are either on the diagonal or one row/column next to the diagonal. Perform reasonable input checks and test your function thoroughly.
Try to make your code both elegant and efficient. Provide a few lines of arguments in
favor of your solution and also submit the source code and results of your tests.
Exercise 3 (15 points) Implement a function streamlineDates(x) that takes a character vector x, searches for all occurrences of dates in the formats “YYYY-MM-DD” and “DD.MM.YYYY”, and replaces them by the same dates in the format “Monthname D, YYYY”. Example: the twoelement input vector
"On the evening of 2017-04-23, I was too tired"
"to complete my homework that was due on 24.04.2017."
should result in the following output vector:
"On the evening of April 23, 2017, I was too tired"
"to complete my homework that was due on April 24, 2017."
Test your code thoroughly and also submit the source code and results of your tests.
Exercise 4 (15 points) Write an R function colSumPos(A) that takes a numeric matrix A of arbitrary format n × m as input (no input checks necessary) and returns a vector that is as long as A’s number of columns that contains the sum of positive elements of each columns. Write one simple-minded variant that uses a nested loop and write another variant that makes the best possible use of vector/matrix operations. Compare the computation times of the two implementations for different test cases and document the results. Provide a few lines of argumentation in favor of your solution. The three fastest implementations are awarded an extra point (tests will be performed using a 2000 × 2000 random matrix).
NOTE: For Exercises 1–4, do not use any add-on packages except those that are pre-loaded when you start R (e.g. base, stats)!
Год: 2017
Данный заказ (программа) выполнялся нашим сайтом в 2017-м году, в рамках этого заказа была разработана программа в среде программирования Язык программирования R. Если у Вас похожее задание на программу, которую нужно написать на Язык программирования R, либо на другом языке программирования, пожалуйста заполните форму, приведённую ниже, после чего Ваше задание в первую очередь рассмотрит наш программист, выполнявший в 2017-м году этот заказ, если он откажется, то Ваше задание оценят другие наши программисты в течение 48-и часов, если оценка нужна срочно, просим Вас оставить пометку об этом - напишите в тексте задания фразу "СРОЧНЫЙ ЗАКАЗ".
Тел.: ![]() Viber: ![]() Telegram: ![]() ВКонтакте: ![]() ![]() E-mail: ![]() Skype: ![]() |