Question

In R create a 5x6x4 array that contains the integers 1 through 120 entered in the...

In R create a 5x6x4 array that contains the integers 1 through 120 entered in the default fashion. Then subset the array to show the second and third row, the first, fourth, and sixth colums and every layer except the first and second.

Homework Answers

Answer #1

We first create the array and named it by X, as follows:

################

X=array(1:120,dim=c(5,6,4))

################

Now we subset the array X, such that it contains the 2nd and 3rd row; 1,4,6th column and 3,4th layer, as follows:

###########################

x[2:3,c(1,4,6),-c(1,2)]

##################

The output is given below:

########################

, , 1

[,1] [,2] [,3]
[1,] 62 77 87
[2,] 63 78 88

, , 2

[,1] [,2] [,3]
[1,] 92 107 117
[2,] 93 108 118

##################################

Know the answer?
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
Similar Questions
Create a 2D numpy array that contains values (4, 3, 1, 33, 21) in the first...
Create a 2D numpy array that contains values (4, 3, 1, 33, 21) in the first row values (67, 27, 89, 34, 67) in the second row and values (60, 99, 89, 12, 43) in the third row Your code should print the following: [[ 4 3 1 33 21] [67 27 89 34 67] [60 99 89 12 43]] Write code that prints values [34, 67] [12, 43]. You must use the colon : based slicing approach to complete...
Giving an array of integers A[1:8] ={5, 1, 3, 2, 7, 6, 8, 4}. Build a...
Giving an array of integers A[1:8] ={5, 1, 3, 2, 7, 6, 8, 4}. Build a MAX-HEAP on A. Show the steps using binary tree representation or array view. Use heap sort: show the array after the first, the second, and the third of heap sort
1.Write a function which takes a string that contains two words separated by any amount of...
1.Write a function which takes a string that contains two words separated by any amount of whitespace, and returns a string in which the words are swapped around and the whitespace is preserved. Hint: use regular expressions where \s detects the whitespaces in a string. Example: given "Hello     World", return "World         Hello" 2.Pandas exercises: Write a python program using Pandas to create and display a one-dimensional array-like object containing an array of data. Write a python program using Pandas to...
First, create 3 equations of the form ax+by+cz=d , where a, b, c, and d are...
First, create 3 equations of the form ax+by+cz=d , where a, b, c, and d are constants (integers between – 5 and 5). For example, x + 2y – 2= -1 . Perform row operations on your system to obtain a row-echelon form and the solution. Go to the 3D calculator website GeoGebra: www.geogebra.org/3d?lang=pt and enter each of the equations. After you have completed this first task, choose one of the following to complete your discussion post. 1. Reflect on...
Your discussion response for this unit will consist of two parts. First, create 3 equations of...
Your discussion response for this unit will consist of two parts. First, create 3 equations of the form , where a, b, c, and d are constants (integers between – 5 and 5). For example, . Perform row operations on your system to obtain a row-echelon form and the solution. Go to the 3D calculator website GeoGebra: www.geogebra.org/3d?lang=pt and enter each of the equations. After you have completed this first task, choose one of the following to complete your discussion...
The Bear Corporation will begin business operations on January 1, 2015. Below is the anticipated SALES...
The Bear Corporation will begin business operations on January 1, 2015. Below is the anticipated SALES BUDGET (in units):    Jan.                 __0,000 Feb.                 __0,000 Mar.                __0,000 Apr.                __0,000 May                __0,000    To complete the unit sales forecast, use the third, fourth, fifth and sixth digits of your student identification number to fill in the blanks.   If any of these digits contains a "0", use "3" instead.                     Example:   If student ID number is 00607357.   The sales forecast would be: January           ...
1. Which of the following is NOT a type of data anomaly? a. Insertion b. Transformation...
1. Which of the following is NOT a type of data anomaly? a. Insertion b. Transformation c. Deletion d. Modification 2. Functional dependency has the following characteristics EXCEPT a. Attribute Y is functionally dependent upon attribute X, if the value of X uniquely determines the value of Y b. It's a constraint between two tables c. It's a constraint between two attributes (columns) d. Represented as Determinant(s) -> Dependent(s) 3. The definition of a partial dependency is a.One or more...
PLEASE USE MAT LAB ONLY. THANK YOU (a) Create and plot the signals listed below and...
PLEASE USE MAT LAB ONLY. THANK YOU (a) Create and plot the signals listed below and save your Matlab code in a script file. i) Cosine signal of frequency 100 Hz over the range [0,0.1] seconds and samples spaced 10^- 4 seconds apart with a phase of pi/2 and an amplitude of 1.   PLEASE USE MAT LAB ONLY. THANK YOU ii) A square wave that oscillates between 0 and 1 every five samples, plot 3 periods of the waveform. iii)...
Questions 1 through 6 work with the length of the sidereal year vs. distance from the...
Questions 1 through 6 work with the length of the sidereal year vs. distance from the sun. The table of data is shown below. Planet Distance from Sun (in millions of miles) Years (as a fraction of Earth years) ln(Dist) ln(Year) Mercury 36.19 0.2410 3.5889 -1.4229 Venus 67.63 0.6156 4.2140 -0.4851 Earth 93.50 1.0007 4.5380 0.0007 Mars 142.46 1.8821 4.9591 0.6324 Jupiter 486.46 11.8704 6.1871 2.4741 Saturn 893.38 29.4580 6.7950 3.3830 Uranus 1,794.37 84.0100 7.4924 4.4309 Neptune 2,815.19 164.7800 7.9428...
**please write code with function definition taking in input and use given variable names** for e.g....
**please write code with function definition taking in input and use given variable names** for e.g. List matchNames(List inputNames, List secRecords) Java or Python Please Note:    * The function is expected to return a STRING_ARRAY.      * The function accepts following parameters:      *  1. STRING_ARRAY inputNames      *  2. STRING_ARRAY secRecords      */ Problem Statement Introduction Imagine you are helping the Security Exchange Commission (SEC) respond to anonymous tips. One of the biggest problems the team faces is handling the transcription of the companies reported...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT