Questions tagged [data-wrangling]

1242 questions
-1
votes
2 answers

How to store Wine descriptor data

Let's say I have a very large dataset with results from wine tastings with tasting descriptors stored in one of the variables. data.frame(c("red","white","rose"),c("grapefruit, raspberry", "sweet, bold", "tannins, long finish")) The number of…
-1
votes
1 answer

Pivot_longer() over multiple sets of columns in dplyr

I have a wide data frame friend where I'd like to perform pivot_longer() over multiple sets of columns. A minimal example of the data frame is provided below: id <- c(303, 303) year <- c(2020, 2020) city_a <- c("Madrid", "Madrid") PA1 = c("AA",…
Jdv
  • 329
  • 1
  • 10
-1
votes
2 answers

Check if value from one dataframe exists in another dataframe in R

can some help me how to do this in R Programming? Pl check the link i have same kind of situation Check if value from one dataframe exists in another dataframe
Vinith
  • 19
  • 1
  • 5
-1
votes
2 answers

importing data from a pdf file into R

Given page 4 of this PDF file, I was wondering if there is a way (using any R library) to import the 2 columns named SCALE SCORE and FREQ. into R as a .csv or other R-friendly formats?
rnorouzian
  • 7,397
  • 5
  • 27
  • 72
-1
votes
1 answer

Transpose dataframe based on column name/number condition

I am trying to standardize feedback from an API in R. However in some cases, the API returns a different format. This does not allow me to standardize and automate. I have thought of a solution which is as follows: if dataframe has more than 1…
marine8115
  • 588
  • 3
  • 22
-1
votes
1 answer

Move data from one set of columns to another for a subset of rows

I have a dataframe... df <- tibble( id = 1:10, family = c("a","a","b","b","c", "d", "e", "f", "g", "h"), col1_a = c(1, 2, 3, 4, 5, 6, 7, 8, 9, 10), col1_b = c(1, 2, 3, 4, NA, NA, NA, NA, NA, NA), col2_a = c(11, 12, 13, 14, 15, 16, 17, 18,…
Tom
  • 279
  • 1
  • 12
-1
votes
2 answers

Convert the text data in one column into numeric data in R

I have a column in my data frame as genre of the movies and there are many of them. I want to convert it into the numerical data for plotting the correlation matrix. Please help me do that. Genre Genre_numerical Comedy 1 Action …
lala
  • 11
  • 5
-1
votes
2 answers

How to use a dataset to extract specific columns from another dataset?

How to use a dataset to extract specific columns from another dataset?
-2
votes
1 answer

Data wrangling in R - case

I have this dataset and I am not able to treat the way I need it, I tried to use tidyverse without success. https://drive.google.com/file/d/1hQXIQJN5EAnTsv6Q6PeWGLqcQXLsWDBo/view?usp=share_link I need to have the variables in the column and their…
-2
votes
1 answer

I want to create a list/array with missing values as element then, I wanted to fill that with some conditions

import pandas as pd create a dataframe from the given data #I wanted to create missing values for column-0 data_frame = pd.DataFrame({'column-0': ['Mumbai', '', 'Mumbai', 'Mumbai', 'Mumbai', 'Moscow', ''],'column-1': ['2022-10-26 07:07:41',…
-2
votes
1 answer

is there a more efficient way to split a column based on characters?

I have a column named 'email' and I want to create a new column named 'company' that will take strings after the '@' up until the first '.' . finaldf['email'].head(3) 0 person@company.com.br 1 woman@company.com.br 2 people@company.fr I…
-2
votes
1 answer

How to filter out rows that do not fit specified condition in R

I have this data frame: df <- data.frame (ID = c(1:20), Ethnicity = c(rep(c("White", "Asian", "Black", "Hispanic", "Other"), times=20/5)), Age = c(1:20), Set = rep(c(1,2,3,4), times=20/4) ) Is…
jo_
  • 677
  • 2
  • 11
-2
votes
2 answers

How to move data up and get rid of NA?

photo of current data The data shows NA for some points but the information is right below it. It is the same UPC, Store, and Week. How do I group my data to avoid redundancy and the NA data? This is my code so far: `library(tidyverse) RD <-…
-2
votes
1 answer

i want to divide certain values in a column by a number and store that value in another column. in R

this is how my data frame looks and this is what I am doing: enter code here nw_dat$cost_of_2_AUD<-if ( nw_dat$Country=="India") { nw_dat$cost_of_2_AUD <- nw_dat$Average.Cost.for.two/56.7 } else if (nw_dat$Country=="Phillipines") { …
-2
votes
2 answers

Ifelse with multiple conditions across many rows/

Looking to add a column based on the values of other columns, but over more than one row. DF: Studios: A, B, C ... Year:2000-2020 Id:r1,r2,r3,r4... Top1:0,1,0,0,0 Starting data set looks like this…
1 2 3
82
83