Attempt the following:
(a) Write the output of the following statements:
(i) $\mathrm{rep}(\mathrm{X}=\mathrm{C}(\mathrm{T},\mathrm{F},\mathrm{T},\mathrm{F})$$\mathrm{rep}(\mathrm{X}=\mathrm{C}(\mathrm{T},\mathrm{F},\mathrm{T},\mathrm{F})$rep(X=C(T,F,T,F)\operatorname{rep}(\mathrm{X}=\mathrm{C}(\mathrm{T}, \mathrm{F}, \mathrm{T}, \mathrm{F})$\mathrm{rep}(\mathrm{X}=\mathrm{C}(\mathrm{T},\mathrm{F},\mathrm{T},\mathrm{F})$, times $=\mathrm{C}(2,1,2,3))$$=\mathrm{C}(2,1,2,3))$=C(2,1,2,3))=\mathrm{C}(2,1,2,3))$=\mathrm{C}(2,1,2,3))$
(ii) $5\mathrm{\%}/\mathrm{\%}3$$5\mathrm{\%}/\mathrm{\%}3$5%//%35 \% / \% 3$5\mathrm{\%}/\mathrm{\%}3$; diag (3)
(b) Differentiate between the use of the sep and col1 apse arguments of the paste() function.
(c) Write R commands to create a bar plot of the following data by using arguments of the used function for filling up the bars and to give labels to the axis:
(d) Check whether the given loop is finite or infinite. If infinite, do the necessary changes in the written loop to make it finite. $x<-0$$x<-0$x < -0x<-0$x<-0$
repeat { $\mathrm{print}(x\wedge 2)$$\mathrm{print}(x\wedge 2)$print(x^^2)\operatorname{print}(x \wedge 2)$\mathrm{print}(x\wedge 2)$ $x<-x+1$$x<-x+1$x < -x+1x<-x+1$x<-x+1$
if $(x<5)\mathrm{print}(x)\}$$(x<5)\mathrm{print}(x)\}$(x < 5)print(x)}(x<5) \operatorname{print}(x)\}$(x<5)\mathrm{print}(x)\}$ $\mathrm{x}<-0$$\mathrm{x}<-0$x < -0\mathrm{x}<-0$\mathrm{x}<-0$
repeat { $\mathrm{print}(x\wedge 2)$$\mathrm{print}(x\wedge 2)$print(x^^2)\operatorname{print}(x \wedge 2)$\mathrm{print}(x\wedge 2)$ $\mathrm{x}<-\mathrm{x}+1$$\mathrm{x}<-\mathrm{x}+1$x < -x+1\mathrm{x}<-\mathrm{x}+1$\mathrm{x}<-\mathrm{x}+1$
if $(x<5)$$(x<5)$(x < 5)(x<5)$(x<5)$ print $(x)\}$$(x)\}$(x)}(x)\}$(x)\}$
The following data relates to the number of items produced per shift by two workers for a number of days.
Worker A
19
22
24
27
24
18
Worker B
26
37
40
35
NA
NA
Worker A 19 22 24 27 24 18
Worker B 26 37 40 35 NA NA| Worker A | 19 | 22 | 24 | 27 | 24 | 18 |
| :— | :— | :— | :— | :— | :— | :— |
| Worker B | 26 | 37 | 40 | 35 | NA | NA |
(a) Write R command to create a list named LT with worker’s data. Also, after creating the list, do the following tasks:
(i) Use a suitable loop function to compute the mean of number of items produced by each worker in a single line command.
(ii) Extract the worker A data from it by using two different approaches.
(b) Write $\mathrm{R}$$\mathrm{R}$R\mathrm{R}$\mathrm{R}$ command to create a data frame named DF with worker’s data and do the following tasks:
(i) Use suitable function to remove NA from the data and then create a scatter plot.
(ii) Write the known data obtained in step (i) to a .txt file named “WORK”.
Write R commands to:
(a) Create a function to compute ranks (in case of tied ranks) of the given data.
(b) Create a date object named Ddata consisting of the following dates.
26Jan2023, 15Aug2023, 02Oct2023, 05Sep2023
(c) Create an array of two dimension with following elements.
Write R commands to do the following tasks:
(i) Multiply the two matrices.
(ii) Combine the two matrices row-wise.
(iii) Create a function that computes the following expression:
Write $\mathrm{R}$$\mathrm{R}$R\mathrm{R}$\mathrm{R}$ commands to:
(i) Compute the group wise means of $\mathrm{x},\mathrm{y}$$\mathrm{x},\mathrm{y}$x,y\mathrm{x}, \mathrm{y}$\mathrm{x},\mathrm{y}$ and $\mathrm{z}$$\mathrm{z}$z\mathrm{z}$\mathrm{z}$ according to the groups defined by w column using apply family function.
(ii) Sort RData according the y column of it.
Attempt the following:
(a) Write the output of the following statements:
(i) $\mathrm{rep}(\mathrm{X}=\mathrm{C}(\mathrm{T},\mathrm{F},\mathrm{T},\mathrm{F})$$\mathrm{rep}(\mathrm{X}=\mathrm{C}(\mathrm{T},\mathrm{F},\mathrm{T},\mathrm{F})$rep(X=C(T,F,T,F)\operatorname{rep}(\mathrm{X}=\mathrm{C}(\mathrm{T}, \mathrm{F}, \mathrm{T}, \mathrm{F})$\mathrm{rep}(\mathrm{X}=\mathrm{C}(\mathrm{T},\mathrm{F},\mathrm{T},\mathrm{F})$, times $=\mathrm{C}(2,1,2,3))$$=\mathrm{C}(2,1,2,3))$=C(2,1,2,3))=\mathrm{C}(2,1,2,3))$=\mathrm{C}(2,1,2,3))$
(ii) $5\mathrm{\%}/\mathrm{\%}3$$5\mathrm{\%}/\mathrm{\%}3$5%//%35 \% / \% 3$5\mathrm{\%}/\mathrm{\%}3$; diag (3)
Answer:
(a) Write the output of the following statements:
(i) $\mathrm{rep}(\mathrm{X}=\mathrm{C}(\mathrm{T},\mathrm{F},\mathrm{T},\mathrm{F})$$\mathrm{rep}(\mathrm{X}=\mathrm{C}(\mathrm{T},\mathrm{F},\mathrm{T},\mathrm{F})$rep(X=C(T,F,T,F)\operatorname{rep}(\mathrm{X}=\mathrm{C}(\mathrm{T}, \mathrm{F}, \mathrm{T}, \mathrm{F})$\mathrm{rep}(\mathrm{X}=\mathrm{C}(\mathrm{T},\mathrm{F},\mathrm{T},\mathrm{F})$, times $=\mathrm{C}(2,1,2,3))$$=\mathrm{C}(2,1,2,3))$=C(2,1,2,3))=\mathrm{C}(2,1,2,3))$=\mathrm{C}(2,1,2,3))$
In R, this statement would replicate the elements of the vector $X=\text{c}(T,F,T,F)$$X=\text{c}(T,F,T,F)$X=”c”(T,F,T,F)X = \text{c}(T, F, T, F)$X=\text{c}(T,F,T,F)$ according to the times argument $\text{c}(2,1,2,3)$$\text{c}(2,1,2,3)$“c”(2,1,2,3)\text{c}(2, 1, 2, 3)$\text{c}(2,1,2,3)$.
The output would be a logical vector: $\text{c}(T,T,F,T,T,F,F,F)$$\text{c}(T,T,F,T,T,F,F,F)$“c”(T,T,F,T,T,F,F,F)\text{c}(T, T, F, T, T, F, F, F)$\text{c}(T,T,F,T,T,F,F,F)$
(ii) $5\mathrm{\%}/\mathrm{\%}3$$5\mathrm{\%}/\mathrm{\%}3$5%//%35 \% / \% 3$5\mathrm{\%}/\mathrm{\%}3$; diag (3)
In R, 5 %% 3 would calculate the remainder of 5 divided by 3, which is 2.
(b) Differentiate between the use of the sep and collapse arguments of the paste() function.
Answer:
In R, the paste() function is used for concatenating strings. The sep and collapse arguments serve different purposes within this function:
sep Argument:
The sep argument specifies the string that separates the elements to be concatenated. It is used to separate multiple pieces of text that you are joining together.
For example:
paste("Hello","World", sep =" ")
Output: "Hello World"
Here, the sep argument puts a space between “Hello” and “World”.
collapse Argument:
The collapse argument is used when you have a vector of strings that you want to collapse into a single string. It specifies the separator between elements within the resulting single string.
For example:
paste(c("Hello","World"), collapse =" ")
Output: "Hello World"
Here, the collapse argument collapses the vector c("Hello", "World") into a single string, separating the elements by a space.
Key Differences:
sep is used to separate the elements that are being concatenated in a single call to paste().
collapse is used to collapse a vector of strings into a single string.
sep works between the elements in each function call, whereas collapse works on the entire vector to produce a single string.
Here’s an example that uses both sep and collapse:
In this example, sep = "-" puts a hyphen between elements being concatenated (“Hello” with “How”, “World” with “are”, and so on). Then collapse = " " collapses the resulting vector into a single string, separating each element by a space.
Simply click “Install” to download and install the app, and then follow the instructions to purchase the required assignment solution. Currently, the app is only available for Android devices. We are working on making the app available for iOS in the future, but it is not currently available for iOS devices.
Yes, the Complete Solution is guaranteed to be error-free.The solutions are thoroughly researched and verified by subject matter experts to ensure their accuracy.
As of now, you have access to the Complete Solution for a period of 1 Year after the date of purchase, which is sufficient to complete the assignment. However, we can extend the access period upon request. You can access the solution anytime through our app.
The app provides complete solutions for all assignment questions. If you still need help, you can contact the support team for assistance at Whatsapp +91-9958288900
No, access to the educational materials is limited to one device only, where you have first logged in. Logging in on multiple devices is not allowed and may result in the revocation of access to the educational materials.
Payments can be made through various secure online payment methods available in the app.Your payment information is protected with industry-standard security measures to ensure its confidentiality and safety. You will receive a receipt for your payment through email or within the app, depending on your preference.
The instructions for formatting your assignments are detailed in the Assignment Booklet, which includes details on paper size, margins, precision, and submission requirements. It is important to strictly follow these instructions to facilitate evaluation and avoid delays.
The educational materials provided in the app are the sole property of the app owner and are protected by copyright laws.
Reproduction, distribution, or sale of the educational materials without prior written consent from the app owner is strictly prohibited and may result in legal consequences.
Any attempt to modify, alter, or use the educational materials for commercial purposes is strictly prohibited.
The app owner reserves the right to revoke access to the educational materials at any time without notice for any violation of these terms and conditions.
The app owner is not responsible for any damages or losses resulting from the use of the educational materials.
The app owner reserves the right to modify these terms and conditions at any time without notice.
By accessing and using the app, you agree to abide by these terms and conditions.
Access to the educational materials is limited to one device only. Logging in to the app on multiple devices is not allowed and may result in the revocation of access to the educational materials.
Our educational materials are solely available on our website and application only. Users and students can report the dealing or selling of the copied version of our educational materials by any third party at our email address (abstract4math@gmail.com) or mobile no. (+91-9958288900).
In return, such users/students can expect free our educational materials/assignments and other benefits as a bonafide gesture which will be completely dependent upon our discretion.