Category "r"

How to recursively create squares, based on previous squares?

I have a df that contains coordinates to create a square: library(ggplot2) df = data.frame(xmin = 1, xmax = 3, ymin = 10, ymax = 15) ggplot(df) + geom

Can't suppress error message in R Markdown?

I'm making a tutorial using RMarkdown and I can't suppress the error message I'm getting. The reason I'm suppressing the error is because the code I'm running

How do you identify column numbers based on partial string match in a way that can be used with lapply?

I have a df with about 1200 columns and the colnames are related to the response categories (ie. Likert scale identifiers). It is similar in format to the df cr

RMarkdown: Error in dir.exists(x) : file name conversion problem -- name too long?

I am working on serial reports with RMarkdown. Since the latest R Update to 4.2.0 I get the error: Error in dir.exists(x) : file name conversion problem -- name

Calculating the difference of all variables to all other variables

Suppose my Dataframe look like: w <- sample(-10:10, size =10) x <- sample(-10:10, size =10) y <- sample(-10:10, size =10) z <- sample(-10:10, size =

Split a fasta file into desired nucelotide length but in a sliding window format

Stuck at a R problem. I have a random fasta file: > header AGTCAGTCAGTC My desired output is: segment1 AGTC segment2 GTCA segment3 TCAG segment4 CA

Count number of rows matching >1 criteria

I have a dataframe with two columns, as follows: A<-c(4,4,4,3,2,4,1) B<-c(4,4,2,31,3,1,1) data<-data.frame(A,B) I know I can use grep() to search for

German keyword search - look for every possible combination

I'm working on a project where I define some nouns like Haus, Boot, Kampf, ... and what to detect every version (singular/plurar) and every combination of these

How to create plot with both vertical and horizontal spikelines in plotly?

Plotly offers the option to display a moveable horizontal or vertical "spikeline" by adding layout(hovermode = "x unified") or layout(hovermode = "y unified") (

reshape dataframe from wide to long in R

I have a dataframe including around 300 columns. These columns are grouped. Here is the example: id name fixed_2020 fixed_2019 fixed_2018 fixed_2017 fixed_2016

Errors installing rgdal MacOS - still

There have been many posts regarding problems installing the rgdal package. I've been through lots of them, have tried many of the recommended solutions, but s

How to plot multiple 1 dimensional scatter plot in R based on occurences of a specific value at a specific point of x-axis

I have these datas that determines how absence rate affect student's grade in 3 different years, im trying to plot a one dimensional scatter plot with the three

map function based on a column value of dataframes stored in a list

I am trying to use the map function to do something complex - I'd like to use the values of the Result column per each dataframe I have in a list ( these are m

Match text from one column with another column (vlookup + like)

I'm trying to perform a match of 2 columns but without success. I have one DF1 with 2 columns, Id and JSON. In the second DF2, I have one column with a pattern

Image not rendering in Shiny Server in docker

Background I'm using another docker image and installing Shiny Server via commands in the dockerfile. The images are in a subdirectory named "www" in the app.R

Remove a pattern from a character

I have a character like this: x = "abc [File: abcbdosln}} \n abc \n" And I want to remove File: abcbdosln}} \n from x so that the result would be "abc [ abc \n"

Flagging continuous observations and creating enrolment spans

I have a few large enrolment datasets and I'm trying to create two things: I'd like to flag each uninterrupted monthly observation (final_df1) I'd like to creat

Is it possible to disable the RStudio connections pane?

I wonder if we can disable the RStudio Connection Pane altogether? What I tried so far: untick Connection in Tools / Global Options / Pane Layout / upper right

R: Tetrachoric correlation for multiple variables at one go?

You can see I'm a beginner at this when I'm not even able to reproduce my problem with a dummy dataset... Anyways, here goes: I want to calculate tetrachoric co

R: Tetrachoric correlation for multiple variables at one go?

You can see I'm a beginner at this when I'm not even able to reproduce my problem with a dummy dataset... Anyways, here goes: I want to calculate tetrachoric co