logo
down
shadow

R QUESTIONS

How to retrieve the data frame used in a GEE model fit?
How to retrieve the data frame used in a GEE model fit?
seems to work fine The 789 observations used in model fitting were the ones which were without NA. You had 72 observations as NA in Feed column
TAG : r
Date : January 12 2021, 09:11 PM , By : gopal
R: How to find/replace and then automatically execute code?
R: How to find/replace and then automatically execute code?
should help you out Hard to give an exact answer without a fully reproducible question, but here's an attempt. gsub_file changes the target file in place, so in the code you've written, the substitution will only work once. A better solution would be
TAG : r
Date : January 12 2021, 09:11 PM , By : user150694
Slope of time series (xts) object over rolling window
Slope of time series (xts) object over rolling window
it should still fix some issue It works for me. We don't need summary nor by.column (there is only one column anyways).The resulting range is c(-90, 90) to 3 decimals.
TAG : r
Date : January 12 2021, 09:11 PM , By : Tom D
Is there an R function for comparing rows in data.frame?
Is there an R function for comparing rows in data.frame?
With these it helps I summarized dataset and want to compare the rows with conditions. What functions can I use? , Since we have same number of rows for "Africa" and "Europe" we can do
TAG : r
Date : January 12 2021, 09:11 PM , By : gbodunski
Changing linetype and line color with plot_model()
Changing linetype and line color with plot_model()
around this issue sjPlot seems to be rather rigid when it comes to customisation, but there are ways around it. You can get the data from ggpredict (from ggeffects package) and customise the plot as usual in ggplot.
TAG : r
Date : January 12 2021, 09:11 PM , By : wpoch
Update existing package on CRAN
Update existing package on CRAN
Hope this helps Yes, you need to re-submit the package. See the CRAN policies document
TAG : r
Date : January 12 2021, 07:00 PM , By : Fahad
Delete NA data ,but with certain condition in R
Delete NA data ,but with certain condition in R
This might help you Let's see example data , So maybe you are looking for
TAG : r
Date : January 12 2021, 07:00 PM , By : afds
calculate number and names of similar sounding words from a data frame
calculate number and names of similar sounding words from a data frame
I hope this helps you . If I understood correctly, it seems like you are looking for Levenshtein distance between your subject words. The adist function in the utils package can calculate the Levenshtein distance for you. It returns a matrix with the
TAG : r
Date : January 12 2021, 07:00 PM , By : sgmichelsen
Reset input fields of dynamically generated widgets through insertUI
Reset input fields of dynamically generated widgets through insertUI
With these it helps I am trying to develop a shinyapp that is part of a bigger form. In particular, for this module the users have the possibility to dynamically add (through insertUI) and remove (through removeUI) a new row with the exact same widge
TAG : r
Date : January 12 2021, 07:00 PM , By : Schmidt
How to get the coordinates that spits out min/max value from the function in R?
How to get the coordinates that spits out min/max value from the function in R?
this one helps. Comment to answer so this can be resolved.Use sapply to apply your function to each item of your list:
TAG : r
Date : January 12 2021, 08:33 AM , By : Vorinowsky
running t.test() on multiple columns to output tibble
running t.test() on multiple columns to output tibble
will help you We could take advantage of purrr::map_df(), which is in library(tidyverse), like this:
TAG : r
Date : January 12 2021, 08:33 AM , By : Pieter Taelman
Conditionally replace the values in columns to value in another column using dplyr
Conditionally replace the values in columns to value in another column using dplyr
hope this fix your issue I tried really hard to find an answer to this and I apologize if it's a duplicate. , You can use mutate_at with ifelse:
TAG : r
Date : January 12 2021, 08:33 AM , By : ack
Add count as label to points in geom_count
Add count as label to points in geom_count
This might help you I used geom_count to visualise overlaying points as sized groups, but I also want to add the actual count as a label to the plotted points, like this: , Are you expecting this:
TAG : r
Date : January 12 2021, 08:33 AM , By : Helpful Dude
Temporarily Disable Rprofile
Temporarily Disable Rprofile
wish helps you This is easily done without RStudio by launching R from the command line. You can either launch R with the --no-init-file flag to load without .Rprofile.Another option is to have an alternative .Rprofile in the folder you are launching
TAG : r
Date : January 12 2021, 08:33 AM , By : user152423
Select certain region of column for lm
Select certain region of column for lm
seems to work fine I am trying to build several linear regression models from a data frame with two columns, one of which should only contain a certain part of the column. My data (let's say it's called df) kinda looks like this: , Try either of the
TAG : r
Date : January 12 2021, 01:40 AM , By : Atanas
Convert multiple rows into one row depending on unique values in another column
Convert multiple rows into one row depending on unique values in another column
seems to work fine I have two columns in a data frame. Based on the unique ids in column 1, I want to create a new column that has all the values from column 2 corresponding to that unique id in column1 separated by ,.
TAG : r
Date : January 12 2021, 01:40 AM , By : adbanginwar
Issues installing Plotly Dash for R
Issues installing Plotly Dash for R
Hope that helps Just installed the package to reproduce the error, unfortunately can't be able to reproduce it. However, a potential solution along "error 403 and API rate limit exceeded ..." could be to add your github authorization token in your .R
TAG : r
Date : January 12 2021, 01:40 AM , By : Saul
Is there an R function to retrieve values from a matrix of column names?
Is there an R function to retrieve values from a matrix of column names?
will be helpful for those in need I have a matrix M consisting of column names from a data frame with one row, such that each column name has just one corresponding value in the data frame. Is there a function to create a new matrix with the correspo
TAG : r
Date : January 12 2021, 01:40 AM , By : Ian
R;Too slow to overate loops for million vectors
R;Too slow to overate loops for million vectors
this one helps. You should probably try to vectorize your operations (NB: for loops can often times be avoided in R). In addition, you could check out the data.table package to further improve efficiency:
TAG : r
Date : January 11 2021, 05:14 PM , By : ganok_tor
How to optimize intersect of rows and columns in a matrix?
How to optimize intersect of rows and columns in a matrix?
this will help I wrote a coded_best_intersect function that relies on creating a for loop dynamically in a code_maker function. It evaluates M3 in 30 seconds. Because the code generates a list, I am depending on data.table for rbindlist and the print
TAG : r
Date : January 11 2021, 05:14 PM , By : Marc
Format and export the output of Mann-Kendall test in R to excel from Rstudio
Format and export the output of Mann-Kendall test in R to excel from Rstudio
may help you . I've just started using R and would like to use the trend package to perform Mann-Kendall tests on yearly groundwater level data of multiple wells. Here is a sample from my dataframe pri.csv: , An option would be tidy from broom
TAG : r
Date : January 11 2021, 05:14 PM , By : user98986
how to calculate cumsum with depreciation in a grouped dataframe?
how to calculate cumsum with depreciation in a grouped dataframe?
this one helps. Your function would work if you pass vector to your function instead of dataframe
TAG : r
Date : January 11 2021, 05:14 PM , By : Gianluca Riccardi
reshape wide to long based on part of column name
reshape wide to long based on part of column name
help you fix your problem Using dplyr and tidyr, we can gather the data to long format, separate column name into different columns and spread them to wide format.
TAG : r
Date : January 11 2021, 05:14 PM , By : jaredsmiller
How to get a hyperlink for the words in a description in an r dataframe?
How to get a hyperlink for the words in a description in an r dataframe?
wish help you to fix your issue An option is str_replace from stringr that can replace corresponding elements by passing a vector of values in the replacement.
TAG : r
Date : January 11 2021, 03:34 PM , By : Rohii
shinymeta works locally but breaks when published to shinyapps.io
shinymeta works locally but breaks when published to shinyapps.io
fixed the issue. Will look into that further Examining the logs on shinapps.io, the problem appeared to be with the clipr package. This is a dependency of shinymeta but for some reason didn't seem to be called automatically the way other dependencies
TAG : r
Date : January 11 2021, 03:34 PM , By : user104292
Deparse and (un)escape quotes
Deparse and (un)escape quotes
may help you . There are couple of ways to modify the behavior. One way is to print with cat on the console, copy and paste that (used R 3.6.0)
TAG : r
Date : January 11 2021, 03:34 PM , By : RichAA
Regression table with clustered standard errors in R jupyter notebook?
Regression table with clustered standard errors in R jupyter notebook?
Hope that helps This is a case where the error message is fairly clear: the broom package does not have a glance method for coeftest objects. This is not an accident--the nature of the coeftest object does not allow for broom to calculate model summa
TAG : r
Date : January 11 2021, 03:32 PM , By : Andrew L.
Disaggregate quarterly data to daily data in R keeping values?
Disaggregate quarterly data to daily data in R keeping values?
I wish this help you Here is a tidyr and zoo package answer that uses 'last observation carried forward' after inserting a sequence of dates with NA:
TAG : r
Date : January 11 2021, 03:32 PM , By : vbanos
How to save output to console and file simultaneously in RStudio server?
How to save output to console and file simultaneously in RStudio server?
will help you Looks like sink has an argument split which will send the output both to file and to the output stream (console). e.g.,
TAG : r
Date : January 11 2021, 03:32 PM , By : Monev
Why does data.table j have a different environment when directly calling mget() vs calling mget() inside another functio
Why does data.table j have a different environment when directly calling mget() vs calling mget() inside another functio
Hope that helps I would like to wrap mget() in a simple function so that it returns an unnamed list, and use this function within data.table j. , Here's one way:
TAG : r
Date : January 11 2021, 03:28 PM , By : Elwillow
scale_fill_viridis_c color bar on a log scale
scale_fill_viridis_c color bar on a log scale
wish helps you Here's an approach using scales::pseudo_log_trans, which lets us plot 0 but transition to a log scaling beyond 1.
TAG : r
Date : January 11 2021, 03:28 PM , By : B3CFT
How to change the lab name corresponding to function in ggplot
How to change the lab name corresponding to function in ggplot
I wish did fix the issue. Looks like you need as.name instead of enquo in first_plot. Then the !! will work when creating the plot. A simplified example with iris data:
TAG : r
Date : January 11 2021, 03:28 PM , By : francisco santos
R, filtering for an element in a list in a dataframe cell
R, filtering for an element in a list in a dataframe cell
it should still fix some issue Here's a way with sapply from base R. sapply(d$Children, ...) applies the anonymous function(x) "Kid3" %in% x) to every element of d$Children. This function checks if "Kid3" is present in every element and returns one l
TAG : r
Date : January 11 2021, 03:28 PM , By : Morbo
Extracting only bottom temperature from 4d NetCDF file
Extracting only bottom temperature from 4d NetCDF file
may help you . Try NCO's ncks with a negative hyperslab:
TAG : r
Date : January 11 2021, 03:26 PM , By : user103892
How to add/wrap lines of text to .tex with .sh script
How to add/wrap lines of text to .tex with .sh script
around this issue I'm compiling a pdf with latex and have constantly ran into this issue: whenever I create a landscaped table I have to manually go within the .tex document and wrap , @r2evans, with your help I was able to create this simple script.
TAG : r
Date : January 11 2021, 03:26 PM , By : meehan
R - building new variables from sequenced data
R - building new variables from sequenced data
I wish this help you Few things you need to know to be able to do this: shift function to compare values in your groups separate_rows function to split your strings to get to the normalised data view.
TAG : r
Date : January 11 2021, 03:26 PM , By : BinaryBoy
Sum rows values one after the other
Sum rows values one after the other
this will help I have a DataFrame that describes, for every second from 1 to 120, and for every nodeId from 0 to 8, the distance from one node to the previous one (the distance from nodeId 8 to nodeId 7, from 7 to 6, ..., from 1 to 0). Basically it l
TAG : r
Date : January 11 2021, 03:26 PM , By : Govind Bhavan
Nesting ifelse inside summarytools
Nesting ifelse inside summarytools
To fix the issue you can do I'm helping a colleague with an error in her code. We want to obtain frequencies of units with valid values across 4 variables. She used ifelse to flag units meeting her criteria, then used summarytools::freq to obtain a s
TAG : r
Date : January 11 2021, 02:18 PM , By : FriendL
How best to divide different levels of a factor by one another in dataframe in R?
How best to divide different levels of a factor by one another in dataframe in R?
may help you . Consider reshaping long to wide then calculate division across columns:
TAG : r
Date : January 11 2021, 02:18 PM , By : Roel
Why does my code run multiple times before I type data into the table? How do I make an action button that creates a tab
Why does my code run multiple times before I type data into the table? How do I make an action button that creates a tab
wish of those help Without reproducible data, I'm not sure this will completely solve your problem. If it is your intent to delay the production of the table, then eventReactive() is a good way to do this. In the curly brackets, you can define what t
TAG : r
Date : January 11 2021, 02:18 PM , By : T11M
How to impute missing values not at random?
How to impute missing values not at random?
I think the issue was by ths following , If it makes sense to impute the values, then even if you do not have the 4 questions of a part, you can predict them using the relationship between variables and the similarities between observations. To take
TAG : r
Date : January 11 2021, 02:18 PM , By : ThF
Set the y limits of an added average line of a plotly plot
Set the y limits of an added average line of a plotly plot
This might help you It seems the fill='tozeroy' is kept for the add_segments() call. This works:
TAG : r
Date : January 11 2021, 02:18 PM , By : Fenix Drakken
how to calculate a new column after grouping with dplyr
how to calculate a new column after grouping with dplyr
should help you out Summarize the Revenue and Volume and then take their ratio. Note that summarise proceeds from left to right so that after Revenue and Volume have been defined in the summarise statement the references in the RevByVol definition to
TAG : r
Date : January 11 2021, 02:18 PM , By : pepper
Extract data from rows creating new columns using R
Extract data from rows creating new columns using R
To fix the issue you can do Here is one option with tidyverse (pivot_longer is from the dev versison of tidyr - install info from here), We reshape the data into 'long' format (pivot_longer), and spread it back to 'wide' format after some pre-process
TAG : r
Date : January 11 2021, 11:39 AM , By : kiirpi
Create a filled area line plot with plotly
Create a filled area line plot with plotly
Hope that helps Values on x axis need to be numeric (see example) and ordered.
TAG : r
Date : January 11 2021, 11:39 AM , By : kgw
When do I need parentheses around an if statement to control the sequence of a formula in R?
When do I need parentheses around an if statement to control the sequence of a formula in R?
I hope this helps you . An excellent question. From the R Language Definition:
TAG : r
Date : January 11 2021, 11:39 AM , By : John Q.
my graph in ggplot2 contains an "e" character in y-axis
my graph in ggplot2 contains an "e" character in y-axis
help you fix your problem The e stands for 10^, it means that 1.5e7 = 1.5*10^7 = 15'000'000. This "e notation" is rather standard and is the programming version of the scientific notation (with 10 power something, see https://en.wikipedia.org/wiki/Sc
TAG : r
Date : January 11 2021, 11:39 AM , By : smbrant
Making variables immutable in R
Making variables immutable in R
seems to work fine There’s no way to get the same effect as with reserved names. A reserved name simply cannot be shadowed (you can assign to `NA` but it never shadows NA — evaluating NA simply never performs a variable lookup). Whereas variables alw
TAG : r
Date : January 11 2021, 11:39 AM , By : Cesar Sanz
R: Difference between the subsequent ranks of a item group by date
R: Difference between the subsequent ranks of a item group by date
wish help you to fix your issue I would like to derive a ranking of ID given the number of records under a grouped date and find the difference between the sequential ranking of the same ID. , An option is to do a group by 'ID' and then use the diff
TAG : r
Date : January 11 2021, 11:39 AM , By : nobodyzzz
Match data within multiple time-frames with dplyr
Match data within multiple time-frames with dplyr
To fix the issue you can do I believe this should do what you're after. Note that I made the id column of 'drug' into a regular numeric (I got rid of 'label = "ID", format.stata = "%12.0g"') so that the join on 'id' would work
TAG : r
Date : January 11 2021, 11:39 AM , By : Myatus
Conditional manipulation and extension of rows in data.table also considering previous extensions without for-loop
Conditional manipulation and extension of rows in data.table also considering previous extensions without for-loop
Hope that helps Suppose I have two data.tables: , Same as @Alexis but vectorized instead of lapply over breakpoints:
TAG : r
Date : January 10 2021, 02:06 PM , By : kakashi_
Conditional formula referring to preview row in DF not working
Conditional formula referring to preview row in DF not working
I wish this help you Updated answer: Okay with a better understanding of what you're trying to accomplish here's a for loop version that should be right. Let me know if I'm still missing what your intention is.
TAG : r
Date : January 10 2021, 02:06 PM , By : Asbie
Set hoverinfo text in plotly scatterplot
Set hoverinfo text in plotly scatterplot
will help you One way of doing this is to add the text to each data point, by adding in a variable to the hovertemplate parameter.I don't have a way to test this at the moment, but it should look something like this:
TAG : r
Date : January 10 2021, 02:06 PM , By : Doug
Histogram of Sums from Categorical/Binary Data
Histogram of Sums from Categorical/Binary Data
hop of those help? I wanted a graphical and attractive way to represent column sums for binary data rather than a tabular format. I can't seem to get it to work, though one would think it would be a lay-up. , A tidyverse approach:
TAG : r
Date : January 10 2021, 02:06 PM , By : user86493
Efficiently find set differences and generate random sample
Efficiently find set differences and generate random sample
This might help you It turns out that resampling the labels that are equal to the labels in the data is an even faster approach, using
TAG : r
Date : January 10 2021, 02:06 PM , By : Picoman Games
Find closest points from data set B to point in data set A, using lat long in R
Find closest points from data set B to point in data set A, using lat long in R
seems to work fine Here is solution using a single loop and vectorizing the distance calculation (converted to km).The code is using base R's rank function to order/sort the list of calculated distances.
TAG : r
Date : January 10 2021, 02:04 PM , By : abuiles
dplyr join on column A OR column B
dplyr join on column A OR column B
Any of those help The OR join is not implemented in tidyverse (could be wrong too). But, there is one option to unite the columns of interest together andd then do a regex_right_join/regex_left_join from fuzzyjoin
TAG : r
Date : January 10 2021, 02:04 PM , By : cnemelka
Replace all string if row starts with (within a column)
Replace all string if row starts with (within a column)
fixed the issue. Will look into that further An easier option would be to capture the 'EMEA' or (|) 'Asia' at the start (^) of the string remove other characters following it
TAG : r
Date : January 10 2021, 02:04 PM , By : FuzzyHornet
Is there a possibility to combine position_stack and nudge_x in a stacked bar chart in ggplot2?
Is there a possibility to combine position_stack and nudge_x in a stacked bar chart in ggplot2?
seems to work fine I have a somewhat 'hacky' solution where you essentially just change the geom_text data in the underlying ggplot object before you plot it.
TAG : r
Date : January 10 2021, 02:04 PM , By : Marie Ramos
How can I extract bounding boxes in a row-wise manner using R?
How can I extract bounding boxes in a row-wise manner using R?
seems to work fine I have an sf object containing multiple (square) polygons of a grid. What I like would be to get a column containing for each polygon the four values, which define the bounding box (bottom-left and top-right). , Given your ch_grid
TAG : r
Date : January 10 2021, 02:04 PM , By : Luciano Campos

shadow
Privacy Policy - Terms - Contact Us © scrbit.com