Category "r"

Error in file(filename, "r", encoding = encoding) : cannot open the connection

I have an RScript file (let's call it main.r) which has a reference to another file, using the below code: source("functions.R") But, when I run the RScript fi

R Mann-Whitney-U test output like in SPSS

I want to run Mann-Whitney-U test. But R's wilcox.test(x~y, conf.int=TRUE) does not give such statistics as N, Mean Rank, Sum of Ranks, Z-value for both factors

Error in file(filename, "r", encoding = encoding) : cannot open the connection

I have an RScript file (let's call it main.r) which has a reference to another file, using the below code: source("functions.R") But, when I run the RScript fi

How to install PhantomJS in R Studio?

I wrote a program that needs to run, the following is my R code: library(webshot) webshot("tmp.html","Normal_top100.png", delay =10, vwidth = 1920, vheight=108

How to delay evaluation of function passed as argument to purrr::pmap

I'm trying to use the nested dataframe (https://r4ds.had.co.nz/many-models.html) approach to fit multiple latent class growth curves using lcmm::lcmm() and purr

Sum with particular condition

I would like to know some information, it is possible make a group by with this particular condition: Column Sepal.length take the first value; Sum the column t

Is there an R function to pick only certain row value combinations?

I have a data frame that looks something like this: my_data <- data.frame( letter = c("x","x","x","x","x","y","y","y","y","z","z","z","z"), number = c

Using for loop in R to combine column values based on preceeding column conditions

I am working with a big dataset with multiple observations for a certain gene, on varying dates and with varying expression levels. Data used I would like to su

Image processing 1

Answered my question. Thanks a lot.

Automate Headless Firefox in RSelenium with Profile

I would like to automate an instance of Firefox with RSelenium that is both headless and uses a custom profile (in the simple example below, one that does not l

How to create tertile in R

I Have a column in my dataframe called Score for example DF$Score<-(1.2,2,2,3.2,4.4,4.5,2.5,6.7,8.9,4.8) I want to make a new column containing tertiles of

ggplot with overlapping X axis label

I have a ggplot which looks like this. p2=ggplot(data=data1, aes(x=ID, y = value)) + geom_line(group=1,color='steelblue', size=2) + facet_wrap(~variable)+t

Automatic positioning of images and tables in PowerPoint slide officer

Hi so I have I am trying to write my own function that will automatically size and central align the images/tables that I am generating from officer. The top/le

Create dummy variable with survey package

I want to transform a variable into a dummy using the survey package. I have a complex sample design defined by: library(survey) prestratified_design <- s

How to generate covariate-adjusted cox survival/hazard functions?

I'm using the survminer package to try to generate survival and hazard function graphs for a longitudinal student-level dataset that has 5 subgroups of interest

Can I set a default value for field.types when using dbWriteTable?

I'm trying to write a dataframe to SQL Server using the following line dbWriteTable(conn,"r_test_upload",df, field.types = c(longnotes ="varchar(max)")) By d

R: Reordering Multiple File Path in an object in R [duplicate]

I have 100 files, each named "ABC - Day - 1(to 100).csv". When I read them into R, it is ordered like this: Day1, Day10, Day100, etc. (see fig

R ggplot2 Bar Chart with Round Corners on Top of Bar

I would like to create a ggplot2 bar chart with round corners at the top of the bars. Consider the following example data: data <- data.frame(x = letters[1:

Aligning ggmap and geom_sf maps

I am having problems aligning two maps. They appear to have the same crs but still look off a bit. Notice the California-Nevada border and the California coast.

How to run cor.test() on two different dataframes

I would like to run cor.test() on two seperate dataframes but I am unsure how to proceed. I have two example dataframes with identical columns (patients) but di