Questions tagged [unnest]

unnest is a function from the tidyr package that can expand the list columns.

456 questions
0
votes
0 answers

How to Specify The Partition According to Which a CROSS JOIN UNNEST Clause Should be Applied?

Here is what I am trying to perform with Presto/AWS Athena. I'd be glad to get your remarks/explanations on the following. I have a table called activity_table | member_id | arrays_of_distinct_days_of_activity | where member_id is VARCHAR…
Ronicho
  • 1
  • 1
0
votes
1 answer

Is it possible to unlist() listed data.frame while keeping other columns from data.frame?

I have a data.frame created from other functions which take a list of .xlsx files and reads all workbooks and included sheets. The result is a nice data frame as such: df<-data.frame( file.name…
OctoCatKnows
  • 399
  • 3
  • 17
0
votes
1 answer

BigQuery: The results have much more columns that I have selected after using the UNNEST function & ways to clean the results data

I used the following code to query Google Analytics data from BigQuery. I only selected a few metrics but seeing from the results, it gives me everything starts with "product". #standardSQL SELECT date, prod.productRevenue, …
xxyb
  • 13
  • 1
  • 4
0
votes
1 answer

How to unnest irregular JSON data

I have been looking at many solutions on this site to similar problems for weeks but cannot wrap my head around how to apply them successfully to this particular one: I have the dataset at…
0
votes
1 answer

unnest() used, but still cannot access field text on a value with type ARRAY>, big query

I'm using bigquery to search for patents that contain the word 'metal' in the title. My query: Then I got the following error message: I checked the data structure for title_localized: What I'm doing wrong?
nay2Y
  • 11
  • 2
0
votes
1 answer

How to unnest bigquery field that is stored as a string?

I am trying to unnest a field but something is wrong with my query. Sample data in my table '1234', '{ "id" : "123" , "items" : [ { "quantity" : 1 , "product" : { "id" : "p1" , "categories" : [ "cat1","cat2","cat3"] }}] }' There are 2 fields in…
sam
  • 347
  • 2
  • 10
  • 26
0
votes
1 answer

Extract a sinlge element with unnest from broom::tidy

I want to get a single elemnet from the broom tidy results into an unnested data frame. The table structure is: > zz # A tibble: 1,923 x 5 sys_loc_code data model tidy glance
kray
  • 377
  • 1
  • 3
  • 11
0
votes
1 answer

BigQuery Unnest an Array - Getting dupliates

Im working on GCP Billing queries in BQ. But while extracting array with the cost I'm getting wrong values like unnest returns array elements in row format. So if I have 2 elements in an array for a single row then I'll get 2 rows. EG: Actual…
TheDataGuy
  • 2,712
  • 6
  • 37
  • 89
0
votes
2 answers

How to get COUNT with UNNEST function in Google BigQuery?

I need to get count of events which has specific parameter in it. Let's say, I have param event_notification_received with params (type, title, code_id). And in param code_id - I have unique name of advertisement. And I need to count how much events…
yozhik
  • 4,644
  • 14
  • 65
  • 98
0
votes
1 answer

need help on split row in postgresql query

I have a following table and I need to split row by role_collection value: name role_collection date ------------------------------------ raj 3,5 2018 6 12 gopi 2,3,6 2018 6 12 mani 3,4,5,7 2018…
jani
  • 13
  • 2
0
votes
2 answers

unnest list in pyspark

I am trying to use combineByKey to find the median per key for my assignment (using combineByKey is a requirement of the assignment) and I'm planning to use the following function to return (k, v) pairs where v = a list of all values associated with…
0
votes
0 answers

Unnest works well in Rstudio but throws Error in Shiny

Steps to reproduce my dataset. library(tidyr) # Upgraded to --version 0.8.0.9000 with all fixes to unnest bugs. created_at <- c("2018-02-07T10:13:25Z", "2018-02-07T07:26:54Z", "2018-02-06T19:36:38Z", …
ngamita
  • 329
  • 2
  • 12
0
votes
1 answer

Replace value with NULL in column

I have a dataframe where I want to replace all values in a column that contain the value '2018' with NULL. I have a dataset where every value in a column is a list. There are NULLs included as well. One of the values is not a list and I want to…
nak5120
  • 4,089
  • 4
  • 35
  • 94
0
votes
2 answers

R/Dplyr create a larger dataframe from dataframe with cells that have have comma separated cell values

I'm working off a dataframe like the below. I've done my best to format it in SO. The important thing is that there are the same number of comma separated entries in person, personparty and sponsordate (I've truncated the cells, so they may not be…
Union find
  • 7,759
  • 13
  • 60
  • 111
0
votes
1 answer

Transform a string in a data frame to a vector and unnest the data frame

Given a data frame where each observation in a column is a string of the form "x~y" where x and y are integers. The goal is to transform the "x~y" string into a vector, c(x..y) which is a sequence of numbers that start with integer x and end with…
JUHYEONN
  • 11
  • 4