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

Keep layer name after rasterize

I have a data frame with x, y, values and unique IDs of 50 locations. I converted this data frame to a raster, but I lost the unique IDs of these locations. How can I preserve the name of each location...

View Article


How to make a vector using a for loop

I'm very new to R (and programming in general) and I've been stuck on this (probably very easy) question for a few days...How would one make the vector 3 6 12 24 48 96 192 384 768 with a for loop?All...

View Article


How to filter out negative data in R

$Data4-4 0 1 41 3 4 1I would like to filter out -4 and 4 from the table function. Any idea ? the "table function" showed the frequency the number occurred and the number itself. Bottom = occurrence,...

View Article

Specifying names of arguments with a function in R

What I want to do is the following: I want to write a function, let's call it 'function_creator' with one argument: name, and some additional arguments, such that its output is a function for which the...

View Article

Plot regression lines in R

I need to add regression lines for each different combination of Sex and Race(white/nonwhite). These are the models and the plot I made, but I have no clue on where to put these lines and how to do it....

View Article


How to memoise a function at package startup in R

I work on an R package which wraps API calls. In order to reduce the number of actual calls and to speed things up, I memoise the function making the API call. To do so, I created the following...

View Article

else and conditional categorical statement in R

if (p$2=′0′|p$2=′a0′ and p$3=′0′|p$3='a0') {p$LTD=0 } else {p$LTD=1 } trying to implement if else statement in R return 0 or 1 depending of 2 and 3 else it is one

View Article

Bold text in text of the axis in R using TeX()

How to render bold text in plot in R using TeX?TeX("$\\alpha$") TeX("The ratio of 1 and 2 is $\\frac{1}{2}$") a <- 1:100 plot(a, a^2, xlab=TeX("$\\alpha$ bold text"), ylab=TeX("$\\alpha^2$ bold...

View Article


Image may be NSFW.
Clik here to view.

Creating a zipcode map in R?

I want to create a zipcode map for Dallas. I have this shapefile which should include all postal codes within it (Street files)I've been using this as a resourcebelow is an example of what I would like...

View Article


Summarizing time series data

I have a data file that is two columns, Date, and Time which I have converted to a date and time in R and a glucose column (example below). The data are provided every 5 minutes and I am trying to get...

View Article

Select "All" radio button option in R Shiny

I am trying to create a shiny app which has radio buttons and allows a user to select an "All" button which shows all of the data prior to this filter.I have posted my full code below and here is a...

View Article

Dates Mysteriously Converted to Numeric Data Once Put Into Data Frame

I am using an API to get some data. To get the data, I use:library(httr) data=GET(url, add_headers(Authorization=token)) mydata=content(data)$data In a gross oversimplification, I then format all the...

View Article

Print separated by comma, remove quotes and add special quotes in R

I have a table which contains the names of data frames in TSV format, like so:df1 <- t(c('18-1829.tsv', '19-0193.tsv', '14-381.tsv', '19-940.tsv')) df1 V1 V2 V3 V4 1 18-1829.tsv 19-0193.tsv...

View Article


profit drawdown of each column in data.frame

I want to calculate the profit/drawdown of each column A:C in the data.frame below. Header A thru C can be considered like a stock ticker symbol. Each row can be considered the hourly closing price....

View Article

Tidyverse Select function does not keep the unnamed columns of an unclass item

How can I filter EFA factors to include items that have only the items having loadings greater than a certain threshold? I used fa function. Here is a reproducible code:bfi_cor <- cor(bfi_data)...

View Article


Image may be NSFW.
Clik here to view.

how can I use the stargazer package in R to report the lm.cluster()

alldata5 is my data and OROA,IROA,UROA,X2Y,PGR,LTA,gcode are different variables in this...

View Article

Get Column names using pipes r

I am trying to get column names of NA columns using named pipes in R:-df <- structure(data.frame(id = c(1, 2, NA, NA, NA, NA), cat = c("SS","SS", "SS", "SV", "SV", "SV"), val = c(220L, 222L, 223L,...

View Article


Extracting HTML tags from a webpage - Web Scraping with R

so I am trying to extract the tag (class = "c16H9d") from a website and for some reason the simple html Here is the html snippet of the site:> `<div class="c16H9d"><a age="0"...

View Article

R loading Files from Folder Mac Catalina OS

In version R version 3.6.1 (2019-07-05) -- "Action of the Toes",on Mac Catalina OS. I'm trying to load files from folder, code bellow, however it does not do it at the first time, and I need to run it...

View Article

pivot_wider with duplicates

I have the following dfdf <- structure(list(ID = c(1, 1, 1, 1, 1, 2, 2, 2, 2), value = c("p", "p", "p1", "p2", "p3", "a", "b", "c", "d"), i1 = c(1, 1, 1, 1, 1, 1, 1, 1, 1)), row.names = c(NA, -9L),...

View Article
Browsing all 205372 articles
Browse latest View live


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