Category "r"

Convert the values in a column into row names in an existing data frame

I would like to convert the values in a column of an existing data frame into row names. Is is possible to do this without exporting the data frame and then rei

Determine minimum R version for all package dependencies

I am a package developer and want to state the minimum R version required to use my package in the DESCRIPTION file. available.packages parses DESCRIPTIONS of

Unable to get plots displayed in Rstudio graphical viewer.

When I run my code all my graphs (both ggplot2 and plot) are displayed in an external "Quartz 2 [*]" graphical viewer. I would like them to be displayed in th

Unable to get plots displayed in Rstudio graphical viewer.

When I run my code all my graphs (both ggplot2 and plot) are displayed in an external "Quartz 2 [*]" graphical viewer. I would like them to be displayed in th

How to create a stand alone legend in R

This is a slightly different but very similar question to How can i create a legend without a plot in r but differs in that I do not want to use the -pch- optio

R - "Error in file(file, ifelse(append, "a", "w")) : cannot open the connection"

I have a data frame of this form: X1 X2 X3 X4 R290601 WOVEN TWILL 001 6

Creating a lift chart in R

Suppose I have the following data frame consisting of people with some score associated with them: Score | hasDefaulted 10 | 0 13 | 0 15 | 1 17 | 0

Automatically expanding an R factor into a collection of 1/0 indicator variables for every factor level

I have an R data frame containing a factor that I want to "expand" so that for each factor level, there is an associated column in a new data frame, which conta

How to detect the right encoding for read.csv?

I have this file (http://b7hq6v.alterupload.com/en/) that I want to read in R with read.csv. But I am not able to detect the correct encoding. It seems to be a

check whether all elements of a list are in equal in R

I have a list of several vectors. I would like to check whether all vectors in the list are equal. There's identical which only works for pairwise comparison. S

Adjusting white space between titles and the edge of the plot

I want to create space between the titles (the axis title and the plot title) and the edge of the plot. I tried vjust on axis.title and plot.title with no luck.

How to split a string of author names by comma into a data frame and generate an edgelist to plot a network?

I have a long list of publications saved as a single column in a data frame. I'd like to generate a network of a short subset of co-authors that have contribute

How to play local video in shiny app?(Windows)

I tried the follow code: shinyUI( fluidPage( tags$video(id="video2", type = "video/mp4",src = "sample.mp4", controls = "controls") ) ) shinyServer(fu

Beamer and Table of Content in RMarkdown

Today I started studying Rmarkdown + Beamer. I have a problem creating the table of contents. I create this way: --- title: "Beamer" author: "Me" date: "08/08

Relative frequency histogram in R, ggplot

I can draw relative frequency histogram in R, using lattice package: a <- runif(100) library(lattice) histogram(a) I want to get the same graph in ggplot.

How to reactively change title of ShinyDashboard box in R?

My code looks like below where user can select location from sidebarpanel and based on user selection data is displayed in mainpanel. Next, I would like to dyna

Grouped bar plot in ggplot

I have a survey file in which row are observation and column question. Here are some fake data they look like: People,Food,Music,People P1,Very Bad,Bad,Good P

ggplot2: fill color behaviour of geom_ribbon

I am trying to colour ribbons in ggplot2. When using geom_ribbon, I am able to specify ymin and ymax and a fill color. What it now does is coloring everything t

python(or numpy) equivalent of match in R

Is there any easy way in python to accomplish what the match function does in R? what match in R does is that it returns a vector of the positions of (first) m

predict() and resid() for lavaan.survey

I want to conduct CFA with survey design weight in R. An easy option seems to be using lavaan.survey package. However, from lavaan object created by lavaan.sur