Quantcast
Channel: Active questions tagged r - Stack Overflow
Browsing all 206126 articles
Browse latest View live
↧

How to remove specific rows when a condition is fulfilled?

I am trying to remove/filter out some specific rows when it meets the condition of the two columns if not the column EP is flagged as 1. What is the specific code for this? For example: in the...

View Article


R functions to generate simple tests from random data

I was trying to come up with code that would enable me to generate One sample t-test, independent sample t-test, One way ANOVA, Two-way ANOVA, and a series of histograms one with negative skew, one...

View Article


R: Merging two data.table while filtering for unique ID: only NA as answers

My problem is as follows: I need to analyse data from several different files with a lot of entries (up to 500.000 per column, 10 columns in total). The files are connected through the use of IDs, e.g....

View Article

Using a Raster Stack to compute averages across land or ocean only

I am interested in calculating precipitation averages globally. However, I only want to isolate land and/or oceanic areas to compute the mean of those separately. What I would like to do is somehow...

View Article

In R's data.table package is there a way to join by different keys when some...

I have two tables that have a many to many relationship by 2 keys.One of the tables contains NA values in one of the keys. These NA values typically appear when the other table has only one existing...

View Article


How to copy specific Excel rows and paste it in another file?

See image: I want to copy the table at $B$7:$G$8. How can I select that in R to view the table?

View Article

R code to detect a change in a variable over time for multiple patients

I have a data set with multiple rows per patient, where each row represents a 1-week period of time over the course of 4 months. There is a variable grade that can take on values of 1,2,or 3, and I...

View Article

How would I use ANOVA to find the differences between means of three groups...

I am trying to use ANOVA to find the differences between means of only 'group1', 'group2' and 'group5' in the below dataset.tab_csv <- read.csv("data.csv", sep = "\t", header = TRUE) tab_csv label...

View Article


Image may be NSFW.
Clik here to view.

Extract the edges of connected matrix cells

I have an n x p binary matrix with disconnected TRUE values. How do I extract the boundaries/edges of horizontally or vertically connected cells (i.e. not diagonally connected ones)?An example:m <-...

View Article


Grouping factors or integers into equivalence classes in R

I have a data frame representing equivalences between members from two sets: print(x) G S 1 g1 s2 2 g1 s1 3 g2 s3 4 g3 s3 5 g4 s3 Does someone know of a function or a useful data structure for grouping...

View Article

Does tidyr complete() use the dplyr group_by() function?

Does tidyr complete() use the dplyr group_by() function? I'm asking because I want to know if I need to ungroup() after using the complete() function.I couldn't find an answer in the tidyr reference page.

View Article

Example of properly done Constellation plot in r

I know and love constellation plots in JMP (link)Are there any canonical examples of the same, done in R? Possibly done with the PAC::constellationPlot library? (link)

View Article

Image may be NSFW.
Clik here to view.

Dual axis plot with automatically calculated sec_axis formula in ggplot2

I need to write a function that would allow me to quickly do a dual axis plot using ggplot2. I know that dual axis plots are generally deprecated, but still I think it may be useful if you're after...

View Article


How to run Rserve with supervisord in docker container?

I want to run Rserve (as daemon process) in docker container.My basic requirement is I want to have one R program which will be running as background process. To achieve this i have created one R file...

View Article

Image may be NSFW.
Clik here to view.

Plotting graphs from class `nb` - How to change points color?

It is easier to explain what am I trying to do through the following reproducible example:library(sf) library(brazilmaps) library(spdep) # loading cities map cities_mg <- brazilmaps::get_brmap(geo =...

View Article


R - object not found error when it exists

I am banging my head trying to understand why "R" cannot find a variable that is definitely in my dataframe. Hoping someone can help.Here is the dput for "DF.1" in my code below:library("dplyr")...

View Article

merging lists of lists together and creating a new column based on the...

I am trying to create a new column in one of 2 separate lists.One element of df1 looks like:$`c(5, 19)` $`c(5, 19)`[[1]] Feature Gain Cover Frequency 1: plaza_eliptica 0.948578681145 0.53759794901...

View Article


How to compute a summary by group with dplyr with a function that takes a...

I'm evaluating the test-retest reliability of a questionnaire. I've got more than 200 pairs of variables (nominal, ordinal, or numeric), each measured at test and retest, for whom I compute a...

View Article

Remove space after lemmatization

I simply lemmatized a character vector. The problem is that the lemmatization creates a space between words unified by a dash (eg. short-term becomes short - term). My character vector is full of these...

View Article

QQ plot for a fitted normal / lognormal distrbution

I'm having problems generating a QQ plot for a fitted distrubution. The data is fitted by NormalFit <- fitdistr(obs, densfun="normal") where obs are the observations.I thought I can just...

View Article
Browsing all 206126 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>