How to solve DiagrammeR waste of space issue in rmarkdown?
In RMarkdown, when I insert a flowchart created with package DiagrammeR it turns out that there is a lot of empty space around the chart (above and below). How can I get rid of that empty space,...
View ArticleHow do I create a new column and add text that is specific to each row in R...
I'm new to R Studio and am learning about dataframes. I'm trying to add the new column "uniqueID" to my dataframe "Populations" with unique values for each row in this new column. No problem, I can...
View ArticleShiny Dashboard Error in datatable: 'data' must be 2-dimensional (e.g. data...
I'm relatively new to shiny dashboards and am having the following error "Error in datatable: 'data' must be 2-dimensional (e.g. data frame or matrix)", which I think means it cannot find the...
View ArticleIssues with wordcloud when using rtweet
I am currently trying to get a wordcloud in R with a script that worked when I first used it. I am now rechecking my markdown document and got the following issue.I am working with rtweet to create a...
View ArticlePutting different custom colors in different facets in multiple density plots...
I am trying to create a faceted density plot using geom_density using a data a part of which is shown below x | cl | |type | ccl 0.919 |Group 8 |Candidate |#BCBDDC 0.538 |Group 4 |Candidate |#FDAE6B...
View ArticleCan you use dynamic column names with tidyeval in an anonymous function?
We can define a function that uses a dynamic column name, then use it in map. Note how the tibbles from ListCol have the column names a and b, taken from the Letter column in the original...
View ArticleHow to transform a dataset in R?
For my job I am trying to write some code to calculate the required number of parking spaces. I have data about the number of cars arriving each hour and about the parking duration (generated via...
View ArticleWinsorizing longitudinal dataset
I would like to winsorize my data. As data is longitudinal (see below for an example) I have to winsorize by ID. Data collection was finished when the value 100 was reached. (Below is just an example,...
View ArticleConcatenate various .txt and .html files to one .txt file in R
I'm trying to write a script that automatically concatenates all files from specific folders automatically to one .txt file but I'm having problems because I'm trying to merge them into one big data...
View ArticleCalculate row-wise maximum
I would like to create a new column, which equals to the maximum value of all columns of that row.Here is an example:library(data.table) data <- data.table(head(iris)) data[ , Species := NULL] data...
View ArticleChange date format in r with as.Date [duplicate]
This question already has an answer here:strptime, as.POSIXct and as.Date return unexpected NA 2 answersI have been given a big dataset, where one column is the date in factor format. I want to change...
View Articlehow ggplot2 gradientn set custom colors and values?
I want to create a heatmap-like plot for my data with custom colors and values. I read some blogs and QAs on StackOverflow, I found that scale_colour_gradientn is the best way to do this. However, I...
View ArticleTransform a large list into a tibble with one column containing all elements
I'am sorry for this question because it seems quite obvious but I can't come up with a solution myself. I have a large list of 130 elements each a list of 10 single character strings.I want to have...
View ArticleError in seas(AirPassengers) : no output has been generated
I am getting this error when I run: library(seasonal) m <- seas(AirPassengers) I have installed the package. I have uninstalled R, Rstudio, reinstalled and tried again, same error.Could someone...
View ArticleCreate sections through a loop with knitr
See this reproducible example :--- title: "test" output: html_document --- ## foo ```{r} plot(1:3) ``` ## bar ```{r} plot(4:7) ``` ## baz ```{r} plot(8:12) ``` I want to be able to automate the...
View ArticleTurning a row slice into a dataset
I am trying to make new datasets from an existing dataset. I want to split it by selecting specific rows to go in each dataset. I have managed to slice out the data I want using my.data %<% slice()....
View ArticleNon-conformable arrays in neural network - neuralnet package
I am trying to create a neural network using this code:countries=read.table('countries.txt',header =TRUE,sep='\t',quote="",dec=",") #install.packages("neuralnet") library(neuralnet)...
View ArticleWhy is my shinydashboard custom css not working?
I am following these instructions:https://rstudio.github.io/shinydashboard/appearance.htmlBut I get this error:Warning: Error in $: $ operator is invalid for atomic vectors 55: dots_list 54:...
View ArticleTransformation of a vector to a data frame with two columns in R
I have the following dataset, it consists of ID's (integer, although all is stored as a factor) and units of time, which belong to the ID above (see an excerpt of data below, total data has 300'000+...
View ArticleHow to add error bar and n=sample size manually in ggplot2?
I am trying to plot a bar graph, but I have some problem with this code, which I am not sure what is the problem in my code. 1) I want a bar graph with mean_se, and also n = 12 and n = 15 below the...
View Article