Questions tagged [wrangle]

Wrangle is the domain-specific language used to build transformation recipes in Cloud Dataprep.

A Wrangle recipe is a sequence of transforms, which are applied to your dataset in order to produce your results.

  • A transform is a single action applied to your dataset. For most transforms, you can pass one or more parameters to define the context (columns, rows, or conditions) where the transform is applied to your dataset.
  • Within some parameters of a transform, you can specify one or more functions. A function is a computational action performed on one or more columns of data in your dataset.
15 questions
2
votes
1 answer

Unpack json columns into a dataframe

I have json strings inside a dataframe column. I want to bring all these new json columns into the dataframe. # Input JsonID <- as.factor(c(1,2,3)) JsonString1 = "{\"device\":{\"site\":\"Location1\"},\"tags\":{\"Engine…
Brad
  • 353
  • 2
  • 10
2
votes
1 answer

Label day timing into morning, afternoon and evening in R

How can i label time of the day (Morning, Afternoon and Evening) for given timestamps? Initial Data Id Time_stamp 3083188c 2016-08-29 13:10:51 924d500e 2016-08-29 09:22:33 ad4dd7ff 2016-08-25 20:29:35 Final data Id …
ajax
  • 121
  • 10
1
vote
1 answer

Wrangle dataframe in R, possibly with dcast

I have a data.frame quite large that I have to wrangle it a bit. the current structure is: V1 V2 V3 V4 V5 V6 V7 V8 ... Vn Vn+1 chr1 1 A T sample_1 value_1 sample_2 value_4 ... sample_n …
Lu_Ste
  • 17
  • 4
1
vote
2 answers

Data Wrangling in R using tidyverse?

So I have this dataset The main transition is pivoting the table, so the population names are on the first column, the names are the headers for each column (and they are renamed, so Chlorophyll is renamed to CHLa for example). The other alteration…
1
vote
2 answers

How can I calculate time duration for given time points in R

I'm trying to find a package or R code that can help to calculate the time duration of different time points for multiple subjects. This is what the data looks like ------------------------------------ SubjectID | Task …
Mr.M
  • 61
  • 6
1
vote
1 answer

Is there a function in R that will let me convert a dataset into "long format" but also merge columns?

I have a dataset derived from Pokemon statistics containing a lot of the numerical and categorical data. My end goal is to create a model or recommendation system that a user can input a list of Pokemon and the model finds similar Pokemon they may…
1
vote
1 answer

How do you add a column to data frames in a list?

I have a list of data frames. I want to add a new column to each data frame. For example, I have three data frames as follows: a = data.frame("Name" = c("John","Dor")) b = data.frame("Name" = c("John2","Dor2")) c = data.frame("Name" =…
jtam
  • 576
  • 1
  • 4
  • 15
1
vote
2 answers

Split dataframe into list based on identical consecutive element

Is there an efficient way to split a dataframe based on identical consecutive element in a column into a list (and keep the order of the dataframe element inside the list) as follow ? The dataframe :…
Sofiane M'barki
  • 153
  • 1
  • 1
  • 11
0
votes
0 answers

Date dataset wrangling to timeline in R

I have complex problem of using dates in dataset. Let me describe the problem and give example. Data is hospital data, where we have information when person got final diagnose (key_date) and data of events when person has been in hospital (date_in,…
jkm
  • 41
  • 6
0
votes
1 answer

Is there an R function that can convert a existing metric into a new logical metric?

I have a dataset derived from Pokemon statistics containing a lot of the numerical and categorical data. My end goal is to create a model or recommendation system that a user can input a list of Pokemon and the model finds similar Pokemon they may…
0
votes
2 answers

How transform all the variables of a data.table of one row to single values

I created DT putting the values in a table: a <- 2 b <- 20 c <- 0.3 DT <- data.table(a, b, c) let's assume that I have only the DT generated. How can from DT generate a, b, c (single values) Thanks and best regards, SH
0
votes
1 answer

How to transform from tibble to dataframe as it is?

First, I averaged the player's data and scaled it down. player <- player %>% group_by(NM) %>% summarise_all(funs(mean(., na.rm = TRUE))) And this is the result. head(player) # A tibble: 6 x 26 NM NO MIN `2PTM` `2PTA` `2PT(%)`…
Sang won kim
  • 508
  • 4
  • 18
0
votes
1 answer

I want to make tidy data

I want to make spread data based on duplicate data. I want to accumulate column based on overlapping rows. For example, X2 column is repeated 5 times. It looks similar to using spread function in tidyr package, but it's a little different. Could you…
Sang won kim
  • 508
  • 4
  • 18
0
votes
1 answer

In DataPrep, sum a set of many columns or values in an object

I have a DataPrep dataset which contains a series of ~10 columns, each of which indicates whether or not a particular brochure was selected: BRO_AF BRO_SAF BRO_SE ... 1 1 1 1 1 I'd like to…
Adam Hopkinson
  • 26,835
  • 7
  • 57
  • 87
-5
votes
4 answers

Wrangle data in R

I would like to go from the left table to the right table in the image below but can't seem to find the coding logic behind to reach the result using R. Tables Your help is much appreciated !