All Questions
8,303
questions
-1
votes
0
answers
21
views
How can I extract longitudes and latitudes from a big List file [closed]
I am trying to extract the longitude and latitude columns from a vessel data list in RStudio. The data already contains longitude and latitude columns with numbers, as I can clearly see in the Excel ...
0
votes
2
answers
60
views
Transfer dataframe to list and not include NA value
How to transfer dataframe to list and not include NA value ? Thanks!
There is dataframe ori_df
library(tidyverse)
ori_df <- data.frame(category=c('a','b',NA),subcategory=c('w',NA,'Z'))
Below code ...
0
votes
1
answer
52
views
Is there a way to loop through a custom function to generate multiple ggplot2 graphs in R?
I created a custom function in R to standardize multiple graphs. The function is essentially as follows:
CustomFunction <- function(SpecificEvent) {
ggplot()+
geom_point(data = df[df$...
1
vote
1
answer
24
views
Long to wide format based on variable suffixes in tidyverse in R
I wonder if there is a way for my DATA to be reformatted to my Desired_output below?
Specifically, for each unique study, we stick together a pair of pre and postNUMBER together, separately for T and ...
0
votes
1
answer
64
views
How to check if elements of one list are also elements of another list in R
Let's assume I have two lists in R, a long one and a shorter one, for example:
list1 = list(571,572,573,574,561,562,563,564,595,570,571,573)
list2 = list(c(571,564,565,600))
Please note that numbers ...
6
votes
2
answers
90
views
Filter list of lists with purrr::keep
I have a reprex as follows:
library(dplyr)
library(purrr)
df1 <- data.frame(
col1 = 1:5,
col2 = 6:10
)
df2 <- df1 %>%
mutate(col3 = 1:5)
ls <- list(
a = list(df1 = df1),
b = ...
0
votes
1
answer
31
views
How to convert results of simulated t-tests into a dataframe?
I am trying to get better intuition about statistical testing by using simulations in R. I would like to simulate t-test results and explore the variation in estimates, p-values etc. I manage to run ...
0
votes
1
answer
37
views
Is there a way to use data.frame to iterate through a list of texts in R?
I used readLines from gutenbergr to read my list of legal cases into R. The code looks like this:
my_list <- list.files(path = "C:\\Users\\Ben Tice\\Documents\\R Stuff\\UW Job\\Cases\\data\\...
0
votes
0
answers
69
views
Find relative paths of all fields, at all depths of a nested list or data.frame in R
Objective
This question is related to, but is not covered or answered by 73083349, 63074814, 76103332, 70272176, 59820309, 74276459.
I'm trying to find/create an efficient (read: fast) function in R ...
3
votes
3
answers
102
views
Creating a frequency table for each column in a data frame using a loop and storing the results in a list
I have a data frame, with each column containing data on group membership. For each column, I would like to calculate the frequency of each group in that column as well as the percentage of each group ...
0
votes
1
answer
48
views
R adding list to a list and different data type to that list in a list
I want to make a list that represents rows to print; a row contains text and numeric data; I make a toplist that contains for each row a list to print.
The list for rows are constructed from stat.desc ...
0
votes
3
answers
57
views
Bind each dataframe in a list to each dataframe of another list
I have two lists composed of dataframes (in the example 3 dataframes per list). I would like to bind the rows of dataframes of the two lists.
I was thinking to couple rbind() with Map(), map() or ...
1
vote
2
answers
39
views
Modify multiple vectors or data frames using loop or list
I am working with a script that imports multiple data frames and before passing them to an function that performs an analysis, it creates a vector for each data frame containing all the column names. ...
2
votes
1
answer
54
views
Optimal way to declare a function F to select from a nested set of functions L
I have a set of model equations that i want to group inside a function to call them as required. As an example of desired workflow, it should be as this call:
F(X=t, mode="B")
I have ...
0
votes
0
answers
29
views
I have a list that contains 12 elements. I would like to make a function that subset the list based on a sequence every nth element
I have a list containing 12 data frames. I would like to subset/split the list after every third elements based on a sequence. And make a new data frame of the new subsetted list .
# my_list
...