Question

In: Statistics and Probability

In R, Create a function that replaces the negative values in a numeric matrix with a...

In R, Create a function that replaces the negative values in a numeric matrix with a random integer between 1 and 10. At the same time, it counts the negative values and prints their number. Apply the function to a 4 by 5 matrix of random continuous uniform values ranging from -10 to 10.

Solutions

Expert Solution


Related Solutions

Given a vector of numeric values. with a R function using loop. testdouble(data). that returns TRUE...
Given a vector of numeric values. with a R function using loop. testdouble(data). that returns TRUE if all the even indexs elements of the vector are twice their preceding value, other wise your function returns FALSE. You can assume that the given vector has an even number of values. TRUE scenarios: c(3, 6, 5, 10, 11, 22, 13, 26) c(0, 0,1, 2, 2, 4, 3, 6) FALSE scenarios: c(3, 7, 5, 6, 11, 22, 13, 26) c(0, 2, 1, 2,...
Write a function in R named counts. This function should take as parameters a numeric vector...
Write a function in R named counts. This function should take as parameters a numeric vector x and also a number indicating a number of bins n. The function will consider the range [min(x),max(x)], and then consider a parti- tion of this interval into n non-overlapping equally sized half open intervals: I1 = [min(x),b1),I2 = [b1,b − 2),...,In = (bn−1,max(x)]. Note that since the intervals are equally sized, the value of bi is constrained. The function will then return a...
Here is the R code for running a t-test: t.test( numeric vector of data values, another...
Here is the R code for running a t-test: t.test( numeric vector of data values, another optional numeric vector of data values,        alternative = c("two.sided", "less", "greater"),        mu = Ho, paired = c(TRUE, FALSE), var.equal = c(TRUE,FALSE),conf.level =1-) 1.) Suppose 30 students are all taking the same Math 115 and English 101 classes at CSUN. You want to know in which class students tend to do better. The data below represents the class averages of the students in both classes....
Here is the R code for running a t-test: t.test( numeric vector of data values, another...
Here is the R code for running a t-test: t.test( numeric vector of data values, another optional numeric vector of data values,        alternative = c("two.sided", "less", "greater"),        mu = Ho, paired = c(TRUE, FALSE), var.equal = c(TRUE,FALSE),conf.level =1-) 2) You want to determine if the average height of men in California is greater than the average height of men in Nebraska. You take a random sample of 30 men in California and 30 men in Nebraska. The data below represents...
Match these values of r with the accompanying​ scatterplots: 0.362​, 0.996​, 0.74​, negative 0.996​, and negative...
Match these values of r with the accompanying​ scatterplots: 0.362​, 0.996​, 0.74​, negative 0.996​, and negative 1. LOADING... Click the icon to view the scatterplots. Match the values of r to the scatterplots. Scatterplot​ 1, requals ▼ 0.362 0.74 negative 0.996 negative 1 0.996 Scatterplot​ 2, requals ▼ 0.996 0.362 negative 1 negative 0.996 0.74 Scatterplot​ 3, requals ▼ negative 1 0.74 negative 0.996 0.362 0.996 Scatterplot​ 4, requals ▼ 0.74 negative 0.996 0.996 negative 1 0.362 Scatterplot​ 5, requals...
There are four numeric columns in R programming language's iris data set. Create a scatter plot...
There are four numeric columns in R programming language's iris data set. Create a scatter plot between the four numeric columns using R programming language and give answers to the following parts. Calculate the correlation between each pair of the four numeric columns in iris. Which pair of variables has the strongest linear relationship? Interpret their ??. Which pair of variables has the weakest linear relationship? Interpret their ??. Which pair(s) of variables can you conclude have a population correlation...
create a function that sorted tuple by the second values of each tuple. If the values...
create a function that sorted tuple by the second values of each tuple. If the values are the same, sorted by increasing order. Finally returns a list of the first element of each tuple that sorted. def sort_tup(tup): #Code here input : tup1 = [(1, 15), (2, 8), (3, 22), (4, 30), (5, 15)] output: [4,3,1,5,2]
Data Structures for R studio Create a numeric vector containing 10 random numbers ranging from 1...
Data Structures for R studio Create a numeric vector containing 10 random numbers ranging from 1 to 10000. Validate that the object you created is a vector Give an example of where you might find this in a biologicall data set. Create a 10-member list containg both numeric and character data. Validate that the object you created is a list Give an example of where you might find this in a biologicall data set. Create a data frame that relates...
Show that R-1(a)R(a) = I, where I is the identity matrix and R(a) is the rotation matrix.
Show that R-1(a)R(a) = I, where I is the identity matrix and R(a) is the rotation matrix. This equation shows that the inverse coordinate transformation returns you to the original coordinate system.  
ARDUINO Create a function that will ask the user to enter the values for each of...
ARDUINO Create a function that will ask the user to enter the values for each of the three colors (red, green and blue) between 0 and 255. The function should check that the user does not enter a number bigger than 255 or smaller than 0. If this happens, the function should keep asking for a valid number.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT