All Questions
61 questions
1
vote
3
answers
154
views
How can I convert a list to numerical in r?
I am using the following data and have come across a roadblock.
I used read.csv to import my raw data into r.
# from OHP$ohp17.value
list(NULL, NULL, "19.9 nmol/L", "0.7 nmol/L", ...
0
votes
1
answer
73
views
R Setting up an if statement inside a for loop
I am extremely new to learning coding so please be patient with me.
I have a list made up of two data frames and I need to add a value into a new column col3 based on another column col1. I apologize ...
-1
votes
1
answer
63
views
Selecting elements of vectors in a list
I have a list with 3 (or more) vectors of characters ordered by total of elements
The first vector has 18 elements
The second vector has 623 elements
The third vector has 1706 elements
I would like to ...
1
vote
1
answer
47
views
Use lapply for an if/else statement on a nested list in R
In R, I am trying to extract POINTs from a nested list containing lists and doubles.
Here is an example of code to create the nested list structure:
library(sf)
GROUP <- c("A", "...
4
votes
5
answers
81
views
Appending List Elements in R
I have two large, ordered lists of integers. I would like the integer length at [i]position of hello to be equal to the length at [i] position of bye.
Here is a simplified reproducible example to ...
1
vote
0
answers
21
views
What's the best way to import data and fill a list in R with empty vectors whose names correspond to file content?
I've been trying to create a list based on a reference file but I can't make it work. I have a .txt file that has a format like this:
Vert 007, Horiz 002
Vert 007, Horiz 004
Vert 005, Horiz 006
Vert ...
0
votes
1
answer
23
views
Attribute labels to scored items [function]
I don't know if the subject has already been find but here my problem :
I have a dataset from behaviors personality items scored from 1 to 8 and I would like to convert each scored according a range (...
0
votes
1
answer
33
views
Check if the corresponding elements in two different list of dataframes are equal
I have a two separate list of dataframes.
The first list of dataframe is lst1
$`1`
[1] 8.523769e-05 6.615035e-05 1.177740e-04 1.173578e-04 8.798214e-05 6.328218e-05 4.768889e-05 3.658710e-05
[9] 1....
0
votes
1
answer
79
views
In R, does ifelse() change the class of an object to list?
Using R, the ifelse() command seems to be changing the class of a model I've saved (and reloaded) to a list instead of keeping it as "glm".
Here is the code that demonstrates the issue:
x1 &...
0
votes
1
answer
33
views
Managing a list of data.frames based on multiple data.frame attributes
I have a list of dataframes that I need to check for three different conditions including corresponding handling of dataframes:
For dataframes with one row: Return the dataframe
For dataframes with &...
0
votes
2
answers
40
views
Optimizing ifelse + loop in R
[[[[ I've been trying to optimize a loop in R, but because I'm not an expert, I can't make much progress. I was wondering if you could help me because it's taking way too much time.]]]]
Basically, I ...
0
votes
2
answers
42
views
R - How to write in specific column in a loop : nothing comes out
I'm working on a R program to automatically write a text in specific cell, in specific rows while being in a loop.
The each d$data.frame is cut into a maximum of 150 rows
The aim is to divide the ...
1
vote
1
answer
125
views
R: Within List of Lists, Reverse Each List Order
I have a list of lists. I want to reverse the order of the elements within each list. I am using this within a for loop, but I've provided a simplified example below.
r1 = c(1,2,3)
r2 = c(4,5,6)
r3 =...
0
votes
1
answer
62
views
Apply ifelse function to a list of dataframes in R
I am new using R and probably it is a very basic question. I have some files inside a folder (8 files) and I put all of them together using list.files(). As results I obtain a list of dataframes. My ...
0
votes
3
answers
171
views
R lapply ifelse with multiple statements on list of dataframes
I have a list (fc.list) of dataframes ("t1.fc.df", "t2.fc.df") that looks like this:
fc.list$t1.fc.df
ID log2.FC qval
1 5.22161 0
2 4.34383 0
3 3.764772 0....