logo
down
shadow

R QUESTIONS

Is there a way to change range of size values in ggplot2 (geom_point) in R?
Is there a way to change range of size values in ggplot2 (geom_point) in R?
it fixes the issue See ?scale_size_continuous.You could try reversing the range values:
TAG : r
Date : November 28 2020, 12:01 PM , By : Surpomp
Plotting exponential function returns excess lines
Plotting exponential function returns excess lines
help you fix your problem 1) ggplot method I tried graphing the data using ggplot2 and I think the output is more what you were expecting...
TAG : r
Date : November 28 2020, 12:01 PM , By : user3042636
How to efficiently extract a row or column from a "dist" distance matrix
How to efficiently extract a row or column from a "dist" distance matrix
Hope this helps Resort to function f in my old answer here.
TAG : r
Date : November 28 2020, 12:01 PM , By : user3042565
Regex expression to remove left over ascii hex code
Regex expression to remove left over ascii hex code
hope this fix your issue We can use a regex to match the < followed by characters that are not space ([^ ]+), ending in > and replace with blank ("")
TAG : r
Date : November 28 2020, 12:01 PM , By : user3042392
grepping special characters in R
grepping special characters in R
This might help you By plugging this regex into https://regexr.com/ I was able to spot the issue: if you have - in a character class, you will create a range. The range from ' to _ happens to include uppercase letters, so you get spurious matches.To
TAG : r
Date : November 27 2020, 05:23 PM , By : user3042387
using simple numbers to assign colors in ggplot2
using simple numbers to assign colors in ggplot2
With these it helps One way to ensure that the same color maps to a specific variable is to use scale_color_manual() with a named vector of colors, where the names are the variables.For example, you can assign the values of mpg$class to a palette of
TAG : r
Date : November 27 2020, 05:23 PM , By : user3042303
Why would "rbind" work faster than "set" for growing a data table?
Why would "rbind" work faster than "set" for growing a data table?
Does that help set is more often an alternative to := for fast assignment to elements of a data.table. This is one example of how it's normally used.As chinsoon12 points out, rbindlist(lapply(filepaths, fread)) should be a faster solution here. In te
TAG : r
Date : November 27 2020, 05:23 PM , By : user3042288
Using ifelse() with R and text removal: how to handle NA values?
Using ifelse() with R and text removal: how to handle NA values?
hope this fix your issue There's an issue with your test - it only returns a single value of FALSE. If you instead use grepl to test you get your expected result:
TAG : r
Date : November 27 2020, 05:23 PM , By : user3042250
I'd like to extend a custom function for barplots so that I can stack the bars
I'd like to extend a custom function for barplots so that I can stack the bars
around this issue It's hard to provide a good answer without more details and what graph you expect as output. Here is a solution using ggplot2 that might start you off. You can imitate the grouped bar plot by merging the two grouping variables while
TAG : r
Date : November 27 2020, 05:23 PM , By : user3042149
How to get tidy dots to accept a variable range
How to get tidy dots to accept a variable range
Any of those help You just need to make sure ... is in the correct environment(the df you provided in this example). And then you can use colnames() to extract the column name.
TAG : r
Date : November 27 2020, 05:23 PM , By : Ivn
Assign identity code based on factor name
Assign identity code based on factor name
This might help you I would like to assign an identity to each data point based on the factor "Name" of data points and where the factor is the same it must have the same identity no or ID tag. I have a large amount of data so this can be a random id
TAG : r
Date : November 27 2020, 05:23 PM , By : user3042123
Vectorized version of charToRaw with good performance
Vectorized version of charToRaw with good performance
will help you This is a version that uses the internal C source for charToRaw without any of the error checking. The loop in Rcpp should be as fast as you can get, although I don't know if there's a better way to handle the memory allocation. As you
TAG : r
Date : November 27 2020, 05:23 PM , By : user3042086
How to find the first occurrence of a negative value for each factor
How to find the first occurrence of a negative value for each factor
Any of those help I am working with weather data and trying to find the first time a temperature is negative for each winter season. I have a data frame with a column for the winter season (1,2,3,etc.), the temperature, and the ID. , A base R option
TAG : r
Date : November 27 2020, 12:01 PM , By : orssoni
rHandsonTable module returning NULL when called from another tabPanel
rHandsonTable module returning NULL when called from another tabPanel
around this issue I have an application that utilizes a rHandsonTableOutput (HoT) in a module that utilizes a tabPanel. While I can get other data from this module (e.g. selections made in a selectInput) for some reason I get a NULL when trying to ge
TAG : r
Date : November 27 2020, 12:01 PM , By : user3041966
Flexdashboard - hidden navbar tab using reactive values
Flexdashboard - hidden navbar tab using reactive values
Does that help Ok, this took me a while figuring out. The fundamental problem is that r chunks in curly brackets of the flexdashboard navbar evaluate in a non-reactive context, compared to the r chucks that build the content of each page, which are e
TAG : r
Date : November 27 2020, 12:01 PM , By : Daniel Mielke
Applying subgrouping to a subgroup in R
Applying subgrouping to a subgroup in R
To fix this issue I have this code to create two subset columns based on quantiles, one column for median split and one column for quartile split. , This can be accomplished using the dplyr package:
TAG : r
Date : November 27 2020, 12:01 PM , By : Roger
How to speed up the proceeds of grepl function?
How to speed up the proceeds of grepl function?
it fixes the issue Trying to use this option into a large number of words and text: , One possibility is to use grepl() with fixed = TRUE:
TAG : r
Date : November 27 2020, 12:01 PM , By : user3041807
change data type by indexing
change data type by indexing
wish help you to fix your issue This happens when you use as.integer on non-integer variables.It seems your numbers have "," in them (ex: 51,66 ) and also new line character which is creating problem so first make your factors "clean" with gsub() and
TAG : r
Date : November 27 2020, 12:01 PM , By : user3041804
ggplot() color each point manually
ggplot() color each point manually
this one helps. Luckily there is a relatively easy solution by using scale_colour_identity(), see the following example:
TAG : r
Date : November 27 2020, 12:01 PM , By : BlueDuna
Copula result in R
Copula result in R
this one helps. I am not sure if I correctly understand your questions. However, if you want to get the copula data (generated from Frank copula) they are stored in sim. If you are asking for the Kendall tau then they should be stored in the fitcopul
TAG : r
Date : November 26 2020, 03:04 PM , By : user3041691
r shiny - display multiple data tables on a page
r shiny - display multiple data tables on a page
it fixes the issue I made some changes to your code. Instead of checkboxInput I opted for the pickerInput from the shinyWidgets package (I added that to your code). Displaying two tables on the same page is already a lot of content, adding checkboxIn
TAG : r
Date : November 26 2020, 03:04 PM , By : user3041675
Rvest read table with cells that span multiple rows
Rvest read table with cells that span multiple rows
should help you out I have a way to code it. It is not perfect, a bit long but it does the trick:
TAG : r
Date : November 26 2020, 03:04 PM , By : user3041673
How to delete outliers from a QQ-plot graph made with ggplot()?
How to delete outliers from a QQ-plot graph made with ggplot()?
will help you There is a CRAN package, referenceIntervals that uses Cook's distance to detect outliers. By applying it to the values of df_qq$y it can then give an index into df_qq to be removed.
TAG : r
Date : November 26 2020, 03:04 PM , By : user3041637
How to retrieve specific information from a file downloaded from a website using R
How to retrieve specific information from a file downloaded from a website using R
Does that help It's easiest if you scrape only the desired section of the webpage, not the whole thing. This can be done with a package like rvest, which lets you select certain HTML elements.
TAG : r
Date : November 26 2020, 03:04 PM , By : user3041567
How to split the string using R, stingr
How to split the string using R, stingr
should help you out Using base R, one approach is to use gsub to extract each individual piece you want. Hope this helps!
TAG : r
Date : November 26 2020, 03:04 PM , By : user3041519
openxlsx::write.xlsx overwriting existing worksheet instead append
openxlsx::write.xlsx overwriting existing worksheet instead append
With these it helps Not sure if I understand correctly, you want to create one xlsx file with two tabs/sheets? Then I usually first create the sheets and then write into each sheet seperatly (This is different from adding data to the same sheet by ap
TAG : r
Date : November 26 2020, 03:04 PM , By : Maique
How can I combine many values into a few groups while adding their response value?
How can I combine many values into a few groups while adding their response value?
I wish this helpful for you It seems you simply want to subset some rows based on some conditions (at least for the 1st part of your question). Could you give an example of the output you are expecting so I can help you with your problem? Thank you.Y
TAG : r
Date : November 26 2020, 03:04 PM , By : user3041489
Divide by last row in mutate in Tidyverse
Divide by last row in mutate in Tidyverse
wish help you to fix your issue We can use n() to return the index of last row for subsetting the value of that column
TAG : r
Date : November 26 2020, 12:01 PM , By : Ken
Can I use AICc to rank models based in nested data?
Can I use AICc to rank models based in nested data?
may help you . Basically, all information criteria (as AIC is) are based on the likelihood function of the model that is influenced by sample size. The sample size is directly correlated with information criteria (greater sample size = lower likeliho
TAG : r
Date : November 26 2020, 12:01 PM , By : user3041310
how to remove bad lines using cmd in data.table?
how to remove bad lines using cmd in data.table?
like below fixes the issue I have a csv.gz file whose content looks like:
TAG : r
Date : November 26 2020, 12:01 PM , By : brokenparser
How to center bars in R barplot() around ticks
How to center bars in R barplot() around ticks
this will help I'm still struggling with a similar problem as R: in barplot midpoints are not centered w.r.t. bars .
TAG : r
Date : November 26 2020, 12:01 PM , By : feserafim
leap year between 2 variables
leap year between 2 variables
To fix this issue A year is a leap year, if it can be divided by 4 but not by 100, except when it is divisible by 400. Create function ans(year1, year2), which returns all the leap years between year1 and year2. For example ans(2000,2010) should retu
TAG : r
Date : November 26 2020, 12:01 PM , By : Pranet Verma
Concatenate/paste together multiple columns in a dataframe
Concatenate/paste together multiple columns in a dataframe
I wish this help you Suppose columns have the same naming convention, you can use purrr::map2_dfc().Prepare data
TAG : r
Date : November 26 2020, 12:01 PM , By : user3041233
How to do colsum and average on the same dataframe
How to do colsum and average on the same dataframe
help you fix your problem I'm not sure if this can help you but that's what I'm using when I want to add a Total row at the end. I also use this with the data.table package.Code example:
TAG : r
Date : November 26 2020, 12:01 PM , By : user3041191
How create new dataframe of model predictions using fitted() to run existing lm/lmer model with interaction?
How create new dataframe of model predictions using fitted() to run existing lm/lmer model with interaction?
fixed the issue. Will look into that further For lack of better phrasing: I need to create a new dataframe from an existing dataframe to run an lm/lmer model to get the model predictions. , The easiest to use modelr:
TAG : r
Date : November 26 2020, 12:01 PM , By : user3041157
Parameterization of Rmarkdown Files
Parameterization of Rmarkdown Files
I wish did fix the issue. To follow up on what others have already said, it is best to call your Rmd from a separate R file using the rmarkdown::render function. This also allows you to easily control the file naming and output location.
TAG : r
Date : November 26 2020, 12:01 PM , By : user3041100
Add a row to a dataframe that repeats a row and replaces 2 entries
Add a row to a dataframe that repeats a row and replaces 2 entries
Hope that helps R objects usually don't modify itself, you need to warp the result in return() to return the modified copy of that dataframe.Change your function to:
TAG : r
Date : November 26 2020, 12:01 PM , By : user3041081
How to name a list of a group_split in dplyr when grouped by more than one column
How to name a list of a group_split in dplyr when grouped by more than one column
Does that help I am using group_split in dplyr and I am struggling to name the list after I have split by more than one column. , Use dplyr::group_keys() to get the grouping variables.
TAG : r
Date : November 26 2020, 12:01 PM , By : WildField
R - create matrix with values based on the relationship between values in multiple columns of another data frame
R - create matrix with values based on the relationship between values in multiple columns of another data frame
Hope that helps I have some data:
TAG : r
Date : November 26 2020, 06:28 AM , By : user3040956
Mean of each row on selected indices
Mean of each row on selected indices
I hope this helps you . You can index matrices with another matrix. In this case your index matrix will give 2 index matrices, as in the function below.First, some data, since you have not posted in a convenient, copypaste able way.
TAG : r
Date : November 26 2020, 06:28 AM , By : user3040933
Why does this apply function return a different value than the loop?
Why does this apply function return a different value than the loop?
hop of those help? I have not spent the time to figure out exactly what you are trying to accomplish, but these two parts of your code do not match in terms of what they are doing:In your apply:
TAG : r
Date : November 26 2020, 06:28 AM , By : koen
Creating a function which creates a vector without needing quotation marks for strings
Creating a function which creates a vector without needing quotation marks for strings
seems to work fine I know that dplyr select has the ability to subset a dataset using column names without quotation marks: , Maybe something like this:
TAG : r
Date : November 26 2020, 06:28 AM , By : user3040903
Why is apply slower than for loop?
Why is apply slower than for loop?
Hope that helps apply stores each model into a list and, if you don't assign the call to a variable, it will print this list. In your for loop, both of those things don't happen.If you modify your for loop like in the code below, you will get running
TAG : r
Date : November 26 2020, 06:28 AM , By : user3040834
Creating a POSIX from a character
Creating a POSIX from a character
Hope this helps I am trying to make my water quality sensor data into time-series data for analysis in R. There is one column with date (format m/dd/yyyy) and another with time (hh:mm:ss)
TAG : r
Date : November 26 2020, 06:28 AM , By : infantjoe
Function matrix
Function matrix
To fix the issue you can do Following the instructions, you have to first create matrix A and then pass it to the function:
TAG : r
Date : November 26 2020, 06:28 AM , By : user3040787
R: Split large character lines into slices
R: Split large character lines into slices
this will help This is a solution made using only base R. You can easily generalize it using apply family or purrr package. First I create some fake data
TAG : r
Date : November 26 2020, 06:28 AM , By : user3040779
ggplot2: overlaying stat_function() with geom_col()
ggplot2: overlaying stat_function() with geom_col()
I wish this help you It's because your geom_col() goes up to 25 and probability density functions have an integral of 1. If I'm correct in assuming your columns resemble a histogram with count data as quantities, you would have to scale your density
TAG : r
Date : November 26 2020, 06:23 AM , By : user3040670
strptime outputing NA when I try and convert from "%Y-%m" format
strptime outputing NA when I try and convert from "%Y-%m" format
I wish this help you Use library zoo. It is useful when you have to deal with dates like that.
TAG : r
Date : November 26 2020, 06:23 AM , By : biranchi007
How to use dates in functions in R?
How to use dates in functions in R?
With these it helps I think there are a few things I would change. I wouldn't nest the function and also have the sapply in the function call. I would create a function and then call the function in sapply in the global environment. Here is the funct
TAG : r
Date : November 26 2020, 06:23 AM , By : user3040609
R - replace a list of numbers in a data frame with a repeating sequence of numbers
R - replace a list of numbers in a data frame with a repeating sequence of numbers
Any of those help If you know that every year has all 12 months then df$month
TAG : r
Date : November 26 2020, 06:23 AM , By : user3040596
How to reduce aligned sequences to start and end coordinates?
How to reduce aligned sequences to start and end coordinates?
This might help you You can make use of rleid and incorporating Frank's comment to remove grouping column
TAG : r
Date : November 26 2020, 06:23 AM , By : user3040553
How to subset rows that contains the same string twice
How to subset rows that contains the same string twice
hope this fix your issue You do vector comparisons. In R, this is implicit. Try this your self:
TAG : r
Date : November 26 2020, 06:23 AM , By : Vijayakumar
How to give value to the one which is not equal to max value in each row?
How to give value to the one which is not equal to max value in each row?
Hope that helps It may be more efficient to use pmax to get the row wise max, then select the columns of interset in mutate_at and replace the values in each column not equal to 0
TAG : r
Date : November 26 2020, 06:23 AM , By : user3040448
Filter rows of a dataframe based on a column when both column name and values to filter are in variables
Filter rows of a dataframe based on a column when both column name and values to filter are in variables
Hope that helps For the following scenario I get an empty data frame , We can convert to symbol and evaluate (!!)
TAG : r
Date : November 26 2020, 06:23 AM , By : jacky chan
using nearest_neighbor_search of distance package
using nearest_neighbor_search of distance package
this one helps. By just writing nearest_neighbor_search(distances, k= 4) where k is the number of nearest neighbours counting itself (e.g. if you want 3 then you should write 4):
TAG : r
Date : November 26 2020, 06:18 AM , By : fastsolutions
R: reducing set to fixed size
R: reducing set to fixed size
should help you out Here's a way to use non-equi joins. There's probably a more efficient way to assign the sd results to the data.table but this is what I have:
TAG : r
Date : November 26 2020, 06:18 AM , By : user3040325
If time in datetime is midnight 00:00:00 change to next day
If time in datetime is midnight 00:00:00 change to next day
With these it helps I'm setting up a large dataset for time-series analysis. The data has a date start time and a date end-time. , if seems pretty straightforward. ifelse is vectorized:
TAG : r
Date : November 26 2020, 06:18 AM , By : JAsdrubal
Remove duplicate rows based on a column values by storing the row whose entry in another column is maximum
Remove duplicate rows based on a column values by storing the row whose entry in another column is maximum
I wish this help you You can sort the matrix first, using ascending order for column 1 and descending order for column 2. Then the duplicated function will remove all but the maximum column 2 value for each column 1 value.
TAG : r
Date : November 26 2020, 06:18 AM , By : Mrzeapple
Function to generate multiple rows of vectors in R
Function to generate multiple rows of vectors in R
To fix the issue you can do Here is my solution. There is one caveat. Since your Date is formatted as integer in the DF that you pasted, to convert it back to Date, you need an origin. I have choosen "1970-01-01" which gives me the starting date as "
TAG : r
Date : November 26 2020, 06:18 AM , By : user3040208
R - Assign special color for lowest value in colorRampPalette
R - Assign special color for lowest value in colorRampPalette
may help you . I have a dataframe like this: , Updated Answer In addition to adding the line
TAG : r
Date : November 25 2020, 12:01 PM , By : tony

shadow
Privacy Policy - Terms - Contact Us © festivalmusicasacra.org