Questions tagged [r]

0 votes
1 replies
Set white background with plot that includes marginals (ggExtra + ggplot2)
I want to generate a PDF with many plots, one per page. These plots contain marginal distributions on the sides, generated with ggExtra: library...
asked 4 months ago
2 votes
1 replies
How do I change the column names using dcast?
I'm transforming my data from long to wide. Part of the data are dates. My problem is that I would like to have other colnames. It is formed li...
asked 4 months ago
0 votes
0 replies
How to fix Error cannot open connection on Ubuntu machine?
This might be a very trivial issue with R-related Ubuntu settings, but I'm pretty new to it and have no clue to solve this issue. I'm trying to...
asked 4 months ago
0 votes
0 replies
How do you create a new object and sort it by year, name and event? [duplicate]
I want to sort a data.frame by multiple columns. For example, with the data.frame below I would like to sort by column z (descending) then by col...
asked 4 months ago
0 votes
1 replies
Omitting NA values for legend in ggplot
TAI structure(list(year = c("2018", "2018", "2018", "2018", "2018", "2018", "2018", "2018", "2018", "2018", "2018", "2018"), month = c(1, 2, 3...
asked 4 months ago
0 votes
0 replies
Link function argument documentation with the package dataset
I'm documenting the package function using roxygen. One argument dataset is explained with a short description in the function, like @params da...
asked 4 months ago
0 votes
0 replies
Error message when adding drift for Arima model
I am using the R forecast package to try to fit an ARMA (2,0,0) model. I think a drift term would help but I'm getting an error message when I tr...
r
asked 4 months ago
0 votes
1 replies
How to efficiently replace one set of values with another set of values in data.table?
This is a typical situation, when you have two datasets, in which the same observations are named differently, and you need to rename one of them...
asked 4 months ago
0 votes
1 replies
Calculate and plot correlation & confidence intervals of one variable against multiple variables
I have the following data (this is a head, the actual data is >100 rows) consisting of all ordinal variables. In the real data, "Beds" ranges...
asked 4 months ago
1 votes
1 replies
Generate permutations in sequential order - R
I previously asked the following question Permutation of n bernoulli random variables in R The answer to this question works great, as long as n...
asked 4 months ago
0 votes
0 replies
What do values of y axis mean in Partial Dependence Plot in R?
I'm using the partialPlot() function to build PDP of the classification random forests and coming across a question: Do values on y axis represen...
r
asked 4 months ago
0 votes
1 replies
The colors in ggplot do not correspond to the colors in the legend
I created a histogram from the World Happiness Report and reorder the values. However, I´d like the colors from the plot to match the colors from...
asked 4 months ago
0 votes
0 replies
R Studio was updated recently. How to I get the package “tree” installed? [duplicate]
I tried to install a package, using install.packages("foobarbaz") but received the warning Warning message: package 'foobarbaz' is not availa...
r
asked 4 months ago
0 votes
0 replies
Implementing Newey-West standard error - Fama-MacBeth cross-sectional regression
I'm trying to implement the Newey-West standard errors into my Fama-MacBeth regression. I've tried several different packages (plm, sandwich,..),...
asked 4 months ago
3 votes
2 replies
Rolling product in R? [duplicate]
This question already has an answer here: Multiplying elements of a column in skipping an element after each iteration...
r
asked 4 months ago
0 votes
1 replies
dplyr grouping help, how to select a value from another column based on vale of another, if empty replace with N/A
I have a dataframe with the following columns userid: unique value for an user transactionId : unique value for the transaction (an user can...
asked 4 months ago
0 votes
0 replies
Using wilcox.test() and t.test() in R yielding to different p-values [migrated]
This is a repost from the R forum, as I was told to post here instead. I would like to test whether there's a significant difference in the mean...
asked 4 months ago
7 votes
4 replies
How to abbreviate a string in R [duplicate]
This question already has an answer here: How to abbreviate long names in a dataframe for R?...
asked 4 months ago
0 votes
0 replies
How to set spacing in a Shiny dashboard for multiple charts
I am trying to plot 6 maps on a shinydashboard app and am able to add 2 maps to a row, but they are cut off and not taking up the entire space in...
asked 4 months ago
0 votes
2 replies
How to add to each column of dataframe value from named vector?
I've got a dataframe df. df <- data.frame(c(4,4,4,4,4,4), c(0,0,0,0,0,0)) colnames(df) <- c("a", "b") > df a b 1 4 0 2...
asked 4 months ago
1 votes
2 replies
Losing data while saving csv character file
i have a very stupid problem that made me loose a few hours, hence I though about posting it here. my data looks something like this df<- d...
asked 4 months ago
0 votes
1 replies
Problem with adding custom words to hunspell dictionary in R
I was able to figure out how to add custom words into the hunspell dictionary in R. However, I'm not sure why it's not being used in spell checki...
asked 4 months ago
-1 votes
0 replies
How could I predict a numeric variable based on the value within a text column? [on hold]
I am using R to work with a dataset that looks like the following: Video Clip Visitors Video Starts "El mejor To...
asked 4 months ago
0 votes
1 replies
Assign unique ID if one value is duplicated in at least one of three columns
I have a data frame with three columns. There are many missing values on these columns. I would like to create a new unique ID column that gives...
r
asked 4 months ago
0 votes
2 replies
Sort columns numerically in R [duplicate]
This question already has an answer here: How to sort a character vector where elements contain letters and numbers in...
asked 4 months ago