logo
down
shadow

R QUESTIONS

how to make a blocked matrix?
how to make a blocked matrix?
help you fix your problem suppose I have the following matrix , R is case-sensitive. BigKernel and Bigkernel are different
TAG : r
Date : January 03 2021, 08:18 AM , By : jaredsmiller
How to summarize with two functions using with dplyr
How to summarize with two functions using with dplyr
wish of those help An option is to add the 'n' also in the grouping variable after grouping by 'group_var' and then do the summarise_at
TAG : r
Date : January 03 2021, 08:18 AM , By : John Q.
Dataframe is no longer the same after being saved to Excel and read back in
Dataframe is no longer the same after being saved to Excel and read back in
wish helps you I find a solution for my problem. Just change the read_xlsx statement as follow
TAG : r
Date : January 03 2021, 08:18 AM , By : user183345
Create duplicate rows using based on availability of data
Create duplicate rows using based on availability of data
hop of those help? I'm trying to split a column by a delimeter, comma in this case, and then make duplicate rows based on the number of elements between commas. I've used str_split_fixed() which will split the column appropriately, but I don't know h
TAG : r
Date : January 03 2021, 08:18 AM , By : sam
Keep empty groups when grouping with data.table in R
Keep empty groups when grouping with data.table in R
hop of those help? I want to keep empty groups (with a default value like NA or 0) when grouping by multiple conditions. , You can try:
TAG : r
Date : January 03 2021, 08:18 AM , By : jonagh
Grouping of Event Time Data based on multiple, iterative conditions
Grouping of Event Time Data based on multiple, iterative conditions
this will help It sounds like you are trying to do two things: 1) For each unique combination of acoustic, species, site code and start-end time, find all other matching acoustic-species-site cases where its start time is
TAG : r
Date : January 03 2021, 08:18 AM , By : Robin Buitenhuis
Formatting Numbers in Flextable for Specific Columns
Formatting Numbers in Flextable for Specific Columns
Hope that helps You can not use argument j as it is not an argument of set_formatter_type. The function is setting formatters for one or several data type. In your case, it's better to use colformat_num.
TAG : r
Date : January 03 2021, 08:18 AM , By : cjdavis
How to store results from for-loop into a dataframe
How to store results from for-loop into a dataframe
should help you out Why not just creating a data.frame with a column as the name you gave here meannam
TAG : r
Date : January 03 2021, 08:18 AM , By : user93312
How to select the values in my dataframe which has logical operator "<" (less than), divide them by two, an
How to select the values in my dataframe which has logical operator "<" (less than), divide them by two, an
Does that help To demonstrate, I downloaded your data and truncated it significantly for the purposes of this Q/A.
TAG : r
Date : January 02 2021, 10:54 PM , By : FriendL
Rowwise extract data between two strings
Rowwise extract data between two strings
I hope this helps you . This is pretty easy, but also pretty faulty if you have some unexpected hiccups in data (like you haven't observed a Phoenix instance yet, or your data starts without a Chicago).The easiest way I can think of is:
TAG : r
Date : January 02 2021, 10:54 PM , By : Dennizzz
Convert a string separate by . and +
Convert a string separate by . and +
it helps some times Here is an idea, but It might be a bit overfitted on your example. However, I can not generalize it due to lack of information regarding the rules.
TAG : r
Date : January 02 2021, 06:48 AM , By : AJacques
stacking function for values in R
stacking function for values in R
hop of those help? I am in the process of creating a new column with values from different datasets. Right Now I am at the point where I added all values at the right place in the dataset, but it is still spread over different columns. This has to be
TAG : r
Date : January 02 2021, 06:48 AM , By : KS9
dplyr coerces characters to factors
dplyr coerces characters to factors
I wish did fix the issue. It is not the dplyr that coerce it to factor, but is the data.frame (base R constructor), where the default option is stringsAsFactors = TRUE. Specifying stringsAsFactors = FALSE will rectify the issue
TAG : r
Date : January 02 2021, 06:48 AM , By : glisignoli
How do I use spread and group_by on a single row dataset
How do I use spread and group_by on a single row dataset
should help you out I have a form dataframe that has multiple entries for same IDs and dates. I need to group this dataset to a single row, but I have some problems with the use of gather, spread and group. , I think you need to remove order before g
TAG : r
Date : January 02 2021, 06:48 AM , By : k19k
Replacing values in one matrix with values from another
Replacing values in one matrix with values from another
will help you I'm trying to compare to matrices. When the values aren't equivalent then I want to use the value from mat2 so long as it is greater than 0; if it is zero, then I want the value from mat1. As the code is currently, it appears to constan
TAG : r
Date : January 02 2021, 06:48 AM , By : Elwillow
Aggregate data and exclude duplicates in one column
Aggregate data and exclude duplicates in one column
Hope that helps Like I mentioned in my comment, I'm not a fan of the table with the data redundancies, but here is one way to solve the problem. Basically, instead of using some sort of 'unique' function, give in index number by group of site/taxa_na
TAG : r
Date : January 02 2021, 06:48 AM , By : toma
Perform an R data.table binary search with OR select
Perform an R data.table binary search with OR select
wish helps you We can use %in% instead of ==. == is used when there is only a single element to compare or the whole column for elementwise comparison. When there are multiple elements, use %in%
TAG : r
Date : January 02 2021, 06:48 AM , By : jazzyfox
How can I include a function in the Standard Deviation parameter of pnorm
How can I include a function in the Standard Deviation parameter of pnorm
may help you . Since sigR is a function of x, you need to pass the x value to that function to get a constant out. The sd= parameter expects a numeric value, not a function.
TAG : r
Date : January 02 2021, 06:48 AM , By : Per
How to get a tidy excel output of P values from R
How to get a tidy excel output of P values from R
around this issue How to get a clean excel dataset of P-values which are exported from R using , I'd use broom::tidy, and readr::write_csv to write it out.
TAG : r
Date : January 02 2021, 06:48 AM , By : kameel
Rotate boxplot legend (R, ggplot2)
Rotate boxplot legend (R, ggplot2)
will be helpful for those in need Okay, I figured it out following a suggestion by @LFischer. There is probably an easier way, but after some trial and error, this did it for me:
TAG : r
Date : January 02 2021, 06:48 AM , By : user167963
dplyr::n() returns “Error: Error: n() should only be called in a data context ”
dplyr::n() returns “Error: Error: n() should only be called in a data context ”
will help you The error disappeared by specifying for each function of the dplyr package the relative package of provenience:
TAG : r
Date : January 02 2021, 06:48 AM , By : Boyer C.
Extract fix columns and one variable column from a list of df´s in R
Extract fix columns and one variable column from a list of df´s in R
should help you out I want to extract the columns 2 and 20 of each df within a list and add a variable for the columns 3:19 and for each of those (16) I want to create a new df. , This is not tested
TAG : r
Date : January 02 2021, 06:48 AM , By : Raghaw
A function that can translate DNA sequence to binary code
A function that can translate DNA sequence to binary code
help you fix your problem Here is an option in base R with outer and ==. We split the 'TEST' by "", do the elementwise comparison to give a list of logical matrices
TAG : r
Date : January 02 2021, 06:48 AM , By : nickthecook
I want to extract 365 netcdf files using loop
I want to extract 365 netcdf files using loop
should help you out I would recommend to wrap your code into a function and use lapply() like this:
TAG : r
Date : January 02 2021, 06:48 AM , By : Keniwan
rvest vs RSelenium results for text extracting
rvest vs RSelenium results for text extracting
may help you . Maybe webdriver, which is a PhantomJS implementation, would do a better job (can't test against RSelenium at the moment):
TAG : r
Date : January 02 2021, 06:48 AM , By : chudq7
Converting wide data to tall data
Converting wide data to tall data
this will help We can use gather from tidyr and create the 'Hemisphere' by recoding the column names to 0 and 1
TAG : r
Date : January 02 2021, 06:48 AM , By : nhuser
How to remove vertical white lines when using ggsave in R?
How to remove vertical white lines when using ggsave in R?
will help you The PDF format is creating these white lines when bars are overlapping. You may be interested to use the PNG format to save the plot as it can be seen in the viewer. Otherwise you may keep the PDF format and revise your plot aesthetics
TAG : r
Date : January 02 2021, 06:48 AM , By : Lunis Neko
R-Shiny error: "renderDataTable" and "server=FALSE"
R-Shiny error: "renderDataTable" and "server=FALSE"
Hope this helps This is explained in ?renderDT. With server = FALSE, all the data are sent to the client-side (the browser), while only the displayed data are sent to the browser with server = TRUE. You get an error because your dataset is too big, a
TAG : r
Date : January 02 2021, 06:48 AM , By : Denis Chaykovskiy
Read csv file with selected rows using data.table's fread
Read csv file with selected rows using data.table's fread
it helps some times I was going through some earlier post- , This worked for me in windows (unix alternative is grep)
TAG : r
Date : January 02 2021, 06:48 AM , By : Kilimanjaro
how to resolve an error like non numeric argument to binary argument?
how to resolve an error like non numeric argument to binary argument?
wish help you to fix your issue While computing SST by typing the command , Are you sure you wrote
TAG : r
Date : January 02 2021, 06:48 AM , By : Gazza
If value exists in environment
If value exists in environment
will be helpful for those in need Is there a way how to check if value exists in R environment and if == TRUE, assign this existing value otherwise assign something else? , if() {} else {} is more suitable for this case:
TAG : r
Date : January 02 2021, 06:48 AM , By : user104292
R get one value according to some rules in each group
R get one value according to some rules in each group
wish help you to fix your issue I have a dataframe: , We can do a group by 'short_name' andd get the first row with slice
TAG : r
Date : January 02 2021, 06:48 AM , By : user87752
Use any apply method to find difference between max and min score for each students
Use any apply method to find difference between max and min score for each students
like below fixes the issue If you are just starting out, this is more difficult because you will likely want to pass what is known as an anonymous function to lapply() as opposed to something readily available like mean. Here is how to do that:
TAG : r
Date : January 02 2021, 06:48 AM , By : LUK
subsetting a dataframe by existing object
subsetting a dataframe by existing object
I wish this help you With tidyverse, we can use !! to check for the 'grade' object in the global environment instead of the column in the 'data' environment, remove the 'G' and do a ==
TAG : r
Date : January 02 2021, 06:48 AM , By : christiandsg
Parsing time formats in R
Parsing time formats in R
This might help you The package lubridate is a godd choice to parse (and work with) dates:
TAG : r
Date : January 02 2021, 06:48 AM , By : Vinicios
How to train a multiple linear regression model to find the best combination of variables?
How to train a multiple linear regression model to find the best combination of variables?
hope this fix your issue The glmulti package will do this fairly effectively:
TAG : r
Date : January 02 2021, 06:48 AM , By : user171752
R replace value in a column by a dictionary table without using merge or join
R replace value in a column by a dictionary table without using merge or join
With these it helps Suppose I have a dict table like: , We can use match from base R
TAG : r
Date : January 02 2021, 06:48 AM , By : desmiserables
write list of dataframes to multiple excel files
write list of dataframes to multiple excel files
wish of those help For write_xlsx from writexl, there is no file argument. It is the path argument
TAG : r
Date : January 02 2021, 06:48 AM , By : usingtechnology
How do I prevent redundant updating in R Shiny?
How do I prevent redundant updating in R Shiny?
it should still fix some issue I think you're looking for updateSliderInput, which will update the slider without re-rendering:
TAG : r
Date : January 02 2021, 06:48 AM , By : ChrisMe
What is the equivalent of officer::ph_location_fullsize( ) in the package rvg?
What is the equivalent of officer::ph_location_fullsize( ) in the package rvg?
I hope this helps . I would like to export multiple edible plots and tables from R to PowerPoint. , Use ph_location_fullsize() and it will work.
TAG : r
Date : January 02 2021, 06:48 AM , By : hammer_1968
str_extract expressions in R
str_extract expressions in R
I wish this helpful for you 1) Match everything up to -ELA followed by anything (.*) up to - followed by captured digits (\\d+)followed by - followed by anything. Then replace that with ELA- followed by the captured digits. No packages are used.
TAG : r
Date : January 02 2021, 06:48 AM , By : Puneet Madaan
dplyr solution to tabulate long data file
dplyr solution to tabulate long data file
will be helpful for those in need After grouping by 'student', slice based on the condition to return rows with the first row where the 'score' is greater than 0 and if all the 'score' are 0, then return the row where the 'grade' is max (which.max),
TAG : r
Date : January 02 2021, 06:48 AM , By : user178372
Is there a R function to sort a data frame
Is there a R function to sort a data frame
This might help you We can use order to get the index and use that to order to rows of data
TAG : r
Date : January 02 2021, 06:48 AM , By : jehammon
How can I switch the positions of the first and last element of a character string?
How can I switch the positions of the first and last element of a character string?
will help you You can do it with sub and backreferences. Using data x
TAG : r
Date : January 02 2021, 06:48 AM , By : Raghaw
How to substitute "Ethiopia" with "Ethiopia (-1992)" and "Ethiopia (1993-)" based on the y
How to substitute "Ethiopia" with "Ethiopia (-1992)" and "Ethiopia (1993-)" based on the y
hop of those help? I am trying to substitute "Ethiopia" in location_1 with "Ethiopia (-1992)" if location_1 says "Ethiopia" and the years correspond to all years up to and including 1992 and with "Ethiopia (1993-)" if location_1 says "Ethiopia" and t
TAG : r
Date : January 02 2021, 06:48 AM , By : Cesar Sanz
Plotting change as bar between the values with ggplot
Plotting change as bar between the values with ggplot
With these it helps Here is a possible solution where I use a second, auxiliary data.frame along with geom_segment() to draw a connecting line between the two timepoints. I've also included some visual customizations like colors, point type, transpar
TAG : r
Date : January 02 2021, 06:48 AM , By : Puneet Madaan
How to find error logs when my dockerized shiny app does not work
How to find error logs when my dockerized shiny app does not work
Any of those help Usually the logs for any (live or dead) container can be found by just using:
TAG : r
Date : January 02 2021, 06:48 AM , By : Mihai Mocanu
Dplyr filter top and bottom rows by value simultaneously on grouped data
Dplyr filter top and bottom rows by value simultaneously on grouped data
seems to work fine , One possibility could be:
TAG : r
Date : January 02 2021, 06:48 AM , By : user121350
Subset table by replacing some row values
Subset table by replacing some row values
wish of those help I have a table only with 0 and 1. The first column has always only 1. The rows are padded with zero once the first 1 occurred. , Use a matrix?
TAG : r
Date : January 02 2021, 06:48 AM , By : Vrki
How can I subtract one row to the row above?
How can I subtract one row to the row above?
wish helps you Let's say I have a the following dataframe df: , Using dplyr:
TAG : r
Date : January 02 2021, 06:48 AM , By : Grace Jones
Comparing Two Data-Frames and Creating A New Data-Frame with Unique Elements
Comparing Two Data-Frames and Creating A New Data-Frame with Unique Elements
To fix this issue You could split the string on whitespace, get the first name and then find the names which are not present in first_names of df2.
TAG : r
Date : January 02 2021, 06:48 AM , By : Tamizhvendan
How to change from factor to numeric without errors
How to change from factor to numeric without errors
it helps some times You have to change the options in R. To do so : options(scipen = 999).It should work, this will prevent scientific notation.
TAG : r
Date : January 02 2021, 06:48 AM , By : jedameron
Randomly picking pairs from a vector in R 153 times
Randomly picking pairs from a vector in R 153 times
hop of those help? From a vector of 18 text values I want to generate 153 pairs where none of the pairs are identical. Is there a way to do this with the sample function? , The combn function has a handy FUN argument:
TAG : r
Date : January 02 2021, 06:48 AM , By : bikefixxer
Removing individuals from cohort study data based on baseline characteristics
Removing individuals from cohort study data based on baseline characteristics
I wish this helpful for you I have health data from a cohort study with repeated measures, where individuals are seen for multiple yearly follow-up visits. At baseline (visit 0), some individuals are already diagnosed with the disease of interest, wh
TAG : r
Date : January 02 2021, 06:48 AM , By : kokok13
Only get data.table groups with a given number of rows
Only get data.table groups with a given number of rows
around this issue I have the following data.table: , If we need to subset, use the .I to get the row indices and subset
TAG : r
Date : January 02 2021, 06:48 AM , By : pad
Change language encoding in existing Df (not on import)
Change language encoding in existing Df (not on import)
wish helps you looking to "correct" the encoding of a DF with a mix of english and french. I'm not loading it from a .csv but from an API, so won't be able to change encoding on import. , You can try iconv:
TAG : r
Date : January 02 2021, 06:48 AM , By : Singularity
Find all the combinations of a particular column and find their frequencies
Find all the combinations of a particular column and find their frequencies
hop of those help? An option in tidyverse would be to be split the 'Mcol' with separate_row, grouped by 'Pcol', get the combn of 'Mcol' and after unnesting take the count of 'Mcol' column
TAG : r
Date : January 02 2021, 06:48 AM , By : lietkynes
Multiple list creation (R)
Multiple list creation (R)
I wish this helpful for you I'm stuck with a problem from 2 days now... , You can use combn.
TAG : r
Date : January 02 2021, 06:48 AM , By : snapshooter
how to use if to create column of df
how to use if to create column of df
it fixes the issue You may use within with which you can manipulate variables of a data frame without the need to reference it all the time with df$. In the brackets [ you create a logical subset (try e.g. df$p.val < 0.01), altogether only the TRUEs
TAG : r
Date : January 02 2021, 06:48 AM , By : PsyberMonkey
Using ampersand (&) inside gsub R function for pattern replacement (backreference to capture group)
Using ampersand (&) inside gsub R function for pattern replacement (backreference to capture group)
Hope that helps It appears like you're looking for the concept of a capture group and backreference.Quoting the BSD sed manual
TAG : r
Date : January 02 2021, 06:48 AM , By : Nicholas Hunter

shadow
Privacy Policy - Terms - Contact Us © scrbit.com