98 Answered Questions for the topic R

Predicting Values for a logarithmic equation in R

I am attempting to understand how to predict expected changes to earnings in R. We are using a dataset from the "Current Population Survey" using the variables average hourly earnings (ahe), age... more

Using R script functions generate random samples and calculate sample means. Be sure to solve all 3 parts of this problem.

Please show the R script coding/steps to solve this. Please do all 3 parts of this question!!! Thanks in advance!!! :)Assume that we have a normal population with a mean of 10 and a variance of 22,... more

Using R Script please show the coding/steps to find the 95% confidence interval for the mean change in percent return to investors.

Thanks in advance!!! Please show all work/ coding in R Script, so I can try to understand how to solve problems like this later on.Fortune magazine (March 1997) reported the total returns to... more

04/07/21

Multivariate regression R output not displaying coefficient values for each variable in the model

When I run the summary(fit2), I only get output showing the intercept and coefficient for the first variable. How can I get the coefficient values for all variables in the model? mydata = ... more

03/07/21

Test effect for linear regression

Is there a way test if there is any overall effect by comparing a model with 1 predictor to a model with two predictors in R?

02/10/21

Modify the function poker() from Ch. 12 of the Primer to a function called bridge() which deals 13 cards instead of 5. The function should also count the hand’s points as follows.

poker = function() {# a function to deal a poker hand# first, create a card decksuit = rep(c("S","H","D","C"),13)suit = sort(suit)suit = as.factor(suit)denom =... more

02/10/21

R related help for statistics

term enrollment 1 2 2 1 3 0 4 4 5 10 6 3 7 9 8 8 9 0 10 9 11 10 12 6 13 20 14 23 15 8 16 23 ... more

If I am trying to create a barplot with errors, what am I doing wrong in this code that is producing an error?

Error message: Error: unexpected '=' in:" summarise(`Support For H-1B Visas` = mean(h1bvis.supp, na.rm = TRUE) %>% sd ="Code:immig %>% mutate(`Full Sample` = case_when( ... more
R

11/06/20

How do I create a new dataset when I need to add new variables?

5b. Time Series Average by Month and YearYou'll need to do a little data prep for this one: - First figure out the top 5 reviewed coffee shops (by number of reviews ~ hint frequency of... more
R

11/02/20

Make is a variable in the data file. Why isn't it recognized?

Problem 5:use the pipe operation to `%>%` pipe data from the MPG dataframe - create a data frame called df_Toyota by performing the following -- pipe from MPG -- Filter make == 'Toyota' --... more
R

11/01/20

I keep getting errors. What is the proper syntax for comparing vectors using same_n?

##### (b) comparing vectors > Given two users's preferences between two options: [Facebook, Instagram], [Firefox, Chrome], [Mac, PC], [Summer, Winter]. - how many things do they aggree on and... more

Statistic using R

In order to adjust the values ​​of the food vouchers of the 9.443 employees of your company, a study will be carried out with the objective of evaluating the average monthly expenditure in... more

08/30/20

Statistics and R

A federal report found that a lie detector test given to someone telling the truth will suggest that they lied in about 20% of cases. A company asks the 12 job applicants for a new position about... more

Branching Processes R Code Tree Diagram

Code: 1) Write an R code for a function that simulates a branching process of a Poisson progeny distribution with mean πœ† and for number of generations n. 2) Then run the simulations for several... more

What does r equal to in the equation 0.5r βˆ’ 3.8 = 5.66?

What's the answer to 0.5rΒ βˆ’ 3.8 = 5.66? I need to find r.
R

10/19/19

Replacement for "rename" in dplyr?

I like plyr's renaming function `rename`. I have recently started using dplyr, and was wondering if there is an easy way to rename variables using a function from dplyr, that is as easy to use as... more
R

10/18/19

How to use the 'sweep' function?

When I look at the source of R Packages, i see the function `sweep` used quite often.Sometimes it's used when a simpler function would have sufficed (e.g., `apply`),other times, it's impossible to... more
R

10/18/19

Adding a column to a data.frame?

I have the data.frame below. I want to add a column that classifies my data according to column 1 (`h_no`) in that way that the first series of h_no 1,2,3,4 is class 1, the second series of `h_no`... more
R

10/17/19

Reorder levels of a factor without changing order of values?

I have data frame with some numerical variables and some categorical `factor` variables. The order of levels for those factors is not the way I want them to be. numbers <- 1:4 letters... more
R

10/17/19

Set default CRAN mirror permanent in R?

How can I set a specific CRAN mirror permanently in R?I want to set it permanently in my laptop so that when I do `install.packages()`, it won't ask me again which mirror to choose.
R

10/17/19

How do I change the formatting of numbers on an axis with ggplot?

I'm using R and ggplot to draw a scatterplot of some data, all is fine except that the numbers on the y-axis are coming out with computer style exponent formatting, i.e. 4e+05, 5e+05, etc. This is... more
R

10/16/19

What's the difference between `1L` and `1`?

I often seen the symbol `1L` (or `2L`, `3L`, etc) appear in R code. Whats the difference between `1L` and `1`? `1==1L` evaluates to `TRUE`. Why is `1L` used in R code?
R

10/15/19

Sample random rows in dataframe?

I am struggling to find the appropriate function that would return a specified number of rows picked up randomly without replacement from a data frame in R language? Can anyone help me out?
R

10/13/19

How do I make a function?

R

10/12/19

To find whether a column exists in data frame or not?

I have a data.frame with the name "abcframe" a b c 1 1 1 2 2 3How might I find whether a column exists or not in a given data frame?For example, I would like to find... more

Still looking for help? Get the right answer, fast.

Ask a question for free

Get a free answer to a quick problem.
Most questions answered within 4 hours.

OR

Find an Online Tutor Now

Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.