Skip to main content

All Questions

Tagged with
1 vote
1 answer
40 views

Extracting an outcome or string from a 'frtest' object (FRAIR package in R)

I'm trying to run a simulation experiment using simulated functional response data. My goal is to use frair_test from the FRAIR package to test for type-II versus type-III functional responses within ...
MadelineJC's user avatar
2 votes
4 answers
84 views

how to populate column based on multiple types of strings in other column

I have a data set of behavioral data. I want to assign all the different behaviors as "aggressive", "submissive", "affiliative", or leave blank in a column of the data ...
Kitt's user avatar
  • 41
0 votes
1 answer
40 views

Across columns with same suffix, sum if a there is a string match

I have a dataset of lake surveys: structure(list(station_id = c("SB_L004", "SB_L005", "SB_P005", "SB_P007", "SB_P008", "SB_P009", "...
CHW's user avatar
  • 3
0 votes
1 answer
43 views

R String column matching and adding

I have a dataset called code_book, and this dataset has a column named New Variable. The content of this column is strings. I want these strings to be the column names of another dataset, which is ...
Humberto R's user avatar
0 votes
2 answers
64 views

Filtering multiple specific columns with multiple string criteria

i have a data set with different diagnosis codes for patients that i want to filter through and view the patients that contain any of the codes i am interested in. i am currently using the str_detect ...
sebastian.mendoza's user avatar
0 votes
1 answer
65 views

How to combine strings in R with the `+` sign?

I have an if statment, that if an argument that is passed to the function, called case, is longer than 1, then the first colname of the data frame would be the combination of the first two values of ...
Programming Noob's user avatar
0 votes
1 answer
45 views

R incongruity when copying a column in R with ifelse

After loading lots of xlsx sheets of multiple workbooks, I want to create a double check of the tidiness and cleanliness of the data source. I created a data frame reading the worksheets as.numeric (...
AnnePauline's user avatar
0 votes
1 answer
42 views

how to tell R to detect structure at the beginning of the word across rows

Is there a way to combine the for loop, grep and case_when functions in the dplyr package to automate some tasks? As an example, I have a data frame in which the first column contains a gene symbol. ...
adR's user avatar
  • 325
0 votes
1 answer
452 views

Using If else to check multiple columns and create a new column based on the response for string responses

I have the following dataset: hairdf=data.frame( id=c(1:4), typedad=c("straight*","curly"), colourdad=c("brown","black"), typemom=c("curly",&...
heemz's user avatar
  • 13
1 vote
2 answers
1k views

Replace empty / NA Values from data table with other values from the same data table in R

I would love to replace empty/NA values from a data table with other values that are shown in the variable of the same data table So I have something like this: Country Nationality currentLoc AR ES RU ...
Le1n0's user avatar
  • 11
1 vote
3 answers
2k views

Ifelse statement : if the strings starts or ends with a particular set of characters, delete them

I'm trying to remove some characters from the strings, but for some reason my code doesn't seem to work. I have the following data data <- as.data.frame (structure(list(col_name = c("applexz&...
Agata's user avatar
  • 417
1 vote
4 answers
2k views

How to use ifelse with str_detect across multiple columns

I have a dataframe that shows ICD-10 codes for people who have died (decedents). Each row in the data frame corresponds to a decedent, each of whom can have up to twenty conditions listed as ...
Mel G's user avatar
  • 142
1 vote
1 answer
2k views

Mutate variable if certain columns contain string in R

I have been struggling for hours with this dataset. I have searched for hours and tried many things, but I failed (I am a novice in R). So I really hope you guys can help me. I have this dataset: ...
R90's user avatar
  • 13
1 vote
2 answers
1k views

Creating new numeric variable in R based on specific strings from character variable

I have a character variable in a data frame, and would like to create a new numeric variable in that data frame based on the existence of specific strings in that character variable. I've figured out ...
user3029412's user avatar
1 vote
5 answers
3k views

Create yes/no column based on values in two other columns

I have a dataset that looks like this: df <- structure(list(ID = 1:10, Region1 = c("Europe", "NA", "Asia", "NA", "Europe", "NA", "...
Japes's user avatar
  • 209

15 30 50 per page