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

Am I using the ggplot function right?

I am trying to plot a scatterplot comparison between 2 variables x and y in my dataframe PDvsPEAKS. Code given below.Abundance_NQ01_positive-IB-DNQ_0.1M_PDvsPeaks <- ggplot(PDvsPeaks, aes(x =...

View Article


How to go from long to wide dataframe in R with multiple values separated by...

Say I have a list of movies with their directors. I want to convert these directors to dummy variables (i.e. if a director directs a movie, they have their own column with a 1, if they don't direct...

View Article


Changing the polarity scores of a word in Sentimentr

I want to edit the polarity scores of certain words in Sentimentr packages. For example, the word "thanks" would have a highly positive score, and I want to mute that.

View Article

In R, does "integer" type inherit from "numeric" type or not?

I'm trying to check the input I'm getting from a user to make sure it's the correct type. In this case, I'm fine with either integer or double as long as it's some kind of number.I'm using...

View Article

Image may be NSFW.
Clik here to view.

R: conditionally combine text from adjacent rows while retaining associated...

The script needs to:a) combine text in adjacent rows, the number of adjacent rows may vary, the grouping of rows to be combined is determined by the first row preceded by a NA and the last row followed...

View Article


R: Select earliest date after permanent change in status (not just earliest...

I have data that looks like this:data <- data.frame(unique_id = c(rep("A",6), rep("B",6)), year = c(seq(2010,2015),seq(2010,2015)), value = c(100,100,100,0,0,0,100,0,100,100,0,0)) I want this:output...

View Article

How to group consecutive rows having same event and find average?

Value <- c(2,3,5,2,5,8,17,3,5) Event <- c(1,1,2,2,2,1,1,2,2) group <- data.frame(pt=Value, Event=Event) I have data like above and I would like to group events in a way that would result into...

View Article

How to generate matched-pairs based on dates?

I have a dataset that includes dates and count of reports. I am tasked with generating matched-pairs using these guidelines:Reports will need to be matched to the week immediately prior to or...

View Article


How do I filter rows depending on values in semi-colon separated columns?

I have a table that looks like this:> dt variant_id transcript_id 0 1 2 1: chr17_45630589_C_A_b38 chr17_46031704_46032046 1584;41 891;27 146;5 2: chr17_45630589_C_A_b38 chr17_46032300_46033079...

View Article


Image may be NSFW.
Clik here to view.

Group values into bins and then plot using plotly (R, Dplyr)

I have a dataset, df, which is telling us that X is the frequency and Category is the 'bin in which the X value belongs. So X is telling us how many times the Category occurs. (This is a small sample...

View Article

R: is there a pandas function map in R?

I want to map values from a named list in R to a dataframe. Is there a equivalent of pandas map function in R?list = (a=1, b=2) df = data.frame(a) df.map(list) in r? I want to map values of list onto df.

View Article

Image may be NSFW.
Clik here to view.

Kable footnotes with math equation and alphabetic notes

I'm having trouble with kable and R Markdown. I would like to create a table with footnotes: 1. a bit of math formula (), 2. with alphabetical notes, 3. and I would like the notes a and b to also show...

View Article

Import data in R from access 365

I got an update at work from office 2010 to office 365. I was using this code to import files from access 2010 to R:library(RODBC) #loads the RODBC package dta <-...

View Article


In a list of data frames, calculate proportion of these that meets a condition

I have a list of data frames (gtf) and I would like to calculate what proportion of each of these data frames have 0's at a set of coordinates [i,j] (coordinates [i,j] == 0). i.e. if I have 500 data...

View Article

find. hyper ()function gamlss

I am trying to create a model to estimate the centiles of the angle variable by the age variable (age). However, I can't run the following model because I don't know how to generate p [1] and I don't...

View Article


extracting last and the second last part of url in R [closed]

how can extract last part and second last part (or maybe more) parts of url and put it into the new columns?lets saymydata: user view 1 https://domain.ca/courses/43/pages/general-guidelines 2...

View Article

Fonts table remains empty after retrieving windows fonts with extrafont package

For saving ggplots with font name Calibri to pdf files, I tried to use the extrafont package in order to be able to use this font type within ggplot2. These were the steps I took:font_import() After...

View Article


How to create a loop calculating the summation of exponents

I'm trying to create a loop that will evaluate this equation. 10 y = ∑X^j j=0 When x = 5. I am trying to use this codey=0 # initialize y to 0 x = 5 for(i in 1:5){y[i] = (exp(x[0:10]))} print(y) but I...

View Article

How to get the difference between data between columns?

![result table][1]I am looking to get produce a new dataframe (or simply add another column) that gives the difference between start and stopHow might I go about doing this? I tried this: difference...

View Article

Image may be NSFW.
Clik here to view.

Why does R plot_ly heatmap extend x limits of my data?

I wanted to render the following content in a heatmap rather than a countour plot:When I render the same content via:p2 <- plot_ly(x=xplot,y=yplot,z=zplot,type="heatmap",zsmooth="best") I getI've...

View Article
Browsing all 206180 articles
Browse latest View live


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