Category "r"

How to filter all rows between two values containing a certain pattern for a list of data frames in R?

I have a large list of about thousand data frames and want to filter all the rows from between two values which contain a string pattern VALUE1 and VALUE2 in th

How to generate a map for property cluster

Could you help me make a graph in R similar to the one I inserted in the image below, which shows the properties on a map, differentiating by cluster. See in my

yfR:Error in download.Error in `vec_slice()`: ! `x` must be a vector, not NULL

I am sure I have installed the latest packages include "quantomd":(devtools::install_github("joshuaulrich/quantmod", ref = "358-getsymbols-new.session")) But st

Convert processed format with stm into dtm (Structural topic modeling)

I have used the textProcessor and the prepDocuments functions from the stm package to clean a corpus. Now I would like to convert the resulting object (list of

How to get rownames to barplot?

I'm new to R, so I'm doing association rule mining using R, where I want to display the foods in the items column on the x axis of the barplot. They should also

how to find where the interval of continuous numbers starts and ends?

I have a vector vec <- c(2, 3, 5, 6, 7, 8, 16, 19, 22, 23, 24) The continuous numbers are: c(2, 3) c(5, 6, 7, 8) c(22, 23, 24) So the first vector starts a

R: Summary statistics for groups / subsets within panel data - code and layout

I have the following data (posted in the comment): Now I would like to have summary statistics. I only need the mean and the number of observations. The summary

Append Radio Button inputs on UI upon User textInput in R shiny

I'm trying to get the textInput from the user and upon submitting it through an action button,I need to update the choices (Append the user input to already exi

(CLOSED) Generating faceted pie charts to indicate weightages

I am looking to build a visual with multiple pie charts to showcase different sleeping conditions and their weightage across a week. Here's my dataset: structur

What code could recreate this excel bar graph in R? (Don't worry about the positive.or.negative column)

Here is the table in Excel: Here is my head(df) in R: Here is my Code: ##Import CSV df<-read.csv("Sentiment Matrix.csv") ##Check top of df > dput(head(d

Attempting to recreate official Stata SEM example in the R-package lavaan

I want to recreate this official Stata example with the R-package lavaan, because I want to know if the same model leads to the same result in

How to find the Consecutive Days from a list of dates or data frame

I need to find consecutive days from the data frame but I am having some trouble trying to find them. I tried R, Excel, and Python but still couldn't find the s

Create a new column based on multiple conditions in other columns in R

I have a data frame that has this structure: dat <- data.frame(col1 = sample(0:3, 10, replace = TRUE), col2 = sample(0:3, 10, replace = TRU

Converting column names so they can be put in an numerical order

I am trying to expand on this answer, by creating a solution that works both on the new_dat and the old_dat. New Data new_dat <- structure(list(`[0,25) east`

Using a keyword between list names to apply a function between elements

I have a list l1 that have file names for each of the list elements. I also have a second list l2, that have some of the same components in the names of the lis

Using add_header_row from flextable to create columns of varying widths

I have data as follows: dat <- structure(list(rn = c("type_A", "type_B", "type_C" ), freq = list(c(0, 0, 0, 5, 7, 16, 28), c(2, 1, 0, 5, 0, 8), c(0, 0,

How to get rid of an error while using the mle function

I tried to run MLE in r using the mle function. It was working fine but I encountered the following error all of a sudden. Can anyone help? Error in if (!all(lo

Increase space between two discrete values in a ggplot2 plot in R

I am trying to figure out how to add space in a plot between two discrete values on the x-axis. For example, in the plot below, I'd like to keep the same spacin

How to resize plot_ly plot in R

I have been trying to plot a surface from the following data z = structure(c(-0.901395069908367, -0.889270928722939, -0.860498522734513, -0.81162341264254, -0.

Surface in plotly does not cover all data, leaving a gap between surface and highlight

I am using a plotly surface plot with data that has some missing values. As you can see in the example below, I am using highlight lines to show the surface doe