Questions tagged [r]

R is a free, open-source programming language & software environment for statistical computing, bioinformatics, visualization & general computing. Please use minimal reproducible example(s) others can run using copy & paste. Show desired output. Use dput() for data & specify all non-base packages with library(). Don't embed pictures for data or code, use indented code blocks instead. For statistics questions, use https://stats.stackexchange.com.

0
votes
0answers
3 views

How to rescale values from [-2, 2] to [0, 100] in R?

I have a data set that shows the score from -2 to 2 for each shop. df <- tribble( ~shop, ~score_1, ~score_2, ~score_3, "A", -2, 1, -1.6, ...
0
votes
0answers
5 views

How to efficiently convert combination value to category based on each value?

I have a dataset like this: 1=cat, 2=dog,3=duck,4=chicken, 5=donkey id<-c(1:10) animal_type<-c("1", "1 2","1 2 3","1 2 3 4", "1 2 3 4 5", "...
0
votes
0answers
8 views

PostgreSQL - Failed to prepare query: ERROR: column "referenceno" does not exist

This is probably a really obvious mistake, but I have been trying a number of things and I do not seem to be able to get the right answer. From R, I try to execute the following DELETE SQL statement ...
0
votes
1answer
10 views

Unexpected dplyr::bind_rows() behavior

Short Version: I'm encountering an error with dplyr::bind_rows() which I don't understand. I want to split my data based on some condition (e.g. a == 1), operate on one part (e.g. b = b * 10), and ...
-1
votes
0answers
8 views

Accessing values of a column that are greater than 33, but I also want to be able to access the ID of individuals who have their value greater than 33

I have a large dataset with a bunch of columns. I have one column titled (rowsums), that are the sums of values in a PTSD questionnaire ( greater than 33 is likely PTSD diagnosis). I want to be able ...
0
votes
0answers
19 views

centering legend title over bottom legend

I am having a bit of trouble getting my legend title to center over my legend when it is on the bottom. I can only do it if I change the legend to vertical instead of horizontal. Here is my code and ...
0
votes
0answers
9 views

Install R serve as a service in windows

How to install R serve as a service in Windows. Installation of R serve is simple process in windows but what about service. I have tired but some how I could not get proper way to do it . can anyone ...
-1
votes
0answers
21 views

Not able to create scatterplot in R. Problem with length function

I am trying to run the following code in R, but I am getting an error for scatter plot3D. The code is as follows: img_me4lt1 <- melt(img1) img_melt2 <- melt(img2) par(mfrow = c(2,2)) plot(...
0
votes
0answers
8 views

How to downsample/aggregate R rasters with custom function to produce multiple output rasters?

I have a rather complex function that I'm using to compute aggregates of raster-cells (downsampling). In this function I'm distuingishing between multiple cases, where the case determines which ...
0
votes
0answers
13 views

No Latex installation detected

Goal: To create a pdf with R markdown that includes a DiagrammeR flowchart. My steps: I ran the code below to render a flowchart created through DiagrammeR. Reviewed and tried documentation and code ...
0
votes
1answer
18 views

Show a legend for each panel in ggplot2?

Given this data: mtcars %>% gather(-mpg, -hp, key = "var", value = "value") %>% mtcars %>% gather(-mpg, -hp, key = "var", value = "value") %...
-2
votes
1answer
25 views

Recode continuous data into categorical data using is.na() and if_else() in R

I have a data frame and one of the columns contain both continuous data and NA. I want to recode all continuous data as one level of categorical data and the NA as another using if_else() and is.na(). ...
0
votes
2answers
16 views

How to match corresponding values to part of string (before and after space)?

I have two dataframes, and want to add values from the 2nd one to the 1st one according to string values, but use partial string matching if there is a space df1: cat small dog apple df2: cat 24 ...
0
votes
0answers
6 views

Highcharter Dot Plots

I'm trying to make the below dotplot in highcharter using R. dotplot example I'm able to do it in ggplot (as shown in the figure) and make it interactive using ggplotly() but I can't seem to replicate ...
0
votes
1answer
16 views

Convert UTM to Latitude and Longitude

I have the following data: EASTING NORTHING 1 535234 7528392 2 538091 7533652 3 540850 7549211 4 543208 7561915 5 552494 7579475 6 553310 7571159 I want to transform it from UTM ...

15 30 50 per page
1
2 3 4 5
28928