Question

a. Use positional matching with seq to create a sequence of values between −4 and 4 that progresses in steps of 0.2. b....

a. Use positional matching with seq to create a sequence of values between −4 and 4 that progresses in steps of 0.2.

b. In each of the following lines of code, identify which style of argument matching is being used: exact, partial, positional, or mixed. If mixed, identify which arguments are specified in each style.

i array(8:1,dim=c(2,2,2))

ii rep(1:2,3)

iii seq(from=10,to=8,length=5)

iv sort(decreasing=T,x=c(2,1,1,2,0.3,3,1.3))

v which(matrix(c(T,F,T,T),2,2))

vi which(matrix(c(T,F,T,T),2,2),a=T)

c. Suppose you explicitly ran the plotting function plot.default and supplied values to arguments tagged type , pch , xlab , ylab , lwd , lty , and col . Use the function documentation to determine which of these arguments fall under the umbrella of the ellipsis.

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

a.

R code to to create a sequence of values between −4 and 4 that progresses in steps of 0.2 using positional matching is,

seq(-4,4,0.2)

b.

Exact matching - Each argument tag is written out in full

Partial - Identify arguments with abbreviated tag

Positional - Supply arguments without tag and R interprets by position

Mixed - Mixture of the three styles

i array(8:1,dim=c(2,2,2))

The syntax of array is,

array(data = NA, dim = length(data), dimnames = NULL)

So, this is a mixed type.

data is positional argument

dim is Exact matching

ii rep(1:2,3)

The syntax of rep is,

rep(x, times)

So, this is a positional type.

iii seq(from=10,to=8,length=5)

Each argument has its full name.

So, this is a Exact matching type.

iv sort(decreasing=T,x=c(2,1,1,2,0.3,3,1.3))

The syntax of Sort is,

sort(x, decreasing = FALSE)

Here True is abbreviated as T, but x is given as full argument name.

So, this is a mixed type.

decreasing is Partial

x is Exact matching

v which(matrix(c(T,F,T,T),2,2))

The syntax of which is,

which(x, arr.ind = FALSE, useNames = TRUE, ind)

All arguments are recognized by position.

So, this is a Positional type.

vi which(matrix(c(T,F,T,T),2,2),a=T)

All arguments are recognized by position.

Here True is abbreviated as T

So, this is a Mixed type.

c.

The syntax of plot is,

plot(x, y = NULL, type = "p",  xlim = NULL, ylim = NULL,
     log = "", main = NULL, sub = NULL, xlab = NULL, ylab = NULL,
     ann = par("ann"), axes = TRUE, frame.plot = axes,
     panel.first = NULL, panel.last = NULL, asp = NA, ...)

So, type, xlab, ylab are present in the plot function.

Hence,   pch , lwd , lty , and col will fall under the umbrella of the ellipsis (...)

Add a comment
Know the answer?
Add Answer to:
a. Use positional matching with seq to create a sequence of values between −4 and 4 that progresses in steps of 0.2. b....
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
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