Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Transpose list #785

Merged
merged 3 commits into from
May 15, 2024
Merged

Transpose list #785

merged 3 commits into from
May 15, 2024

Conversation

DyfanJones
Copy link
Member

obj <- list(
  var1 = c(1, 2, 3),
  var2 = letters[1:3],
  var3 = list(),
  var4 = list()
)

# paws.common 0.7.2
.mapply(list, obj, NULL)
#> list()

# paws.common 0.7.3
paws.common:::transpose(obj)
#> [[1]]
#> [[1]]$var1
#> [1] 1
#> 
#> [[1]]$var2
#> [1] "a"
#> 
#> [[1]]$var3
#> NULL
#> 
#> [[1]]$var4
#> NULL
#> 
#> 
#> [[2]]
#> [[2]]$var1
#> [1] 2
#> 
#> [[2]]$var2
#> [1] "b"
#> 
#> [[2]]$var3
#> NULL
#> 
#> [[2]]$var4
#> NULL
#> 
#> 
#> [[3]]
#> [[3]]$var1
#> [1] 3
#> 
#> [[3]]$var2
#> [1] "c"
#> 
#> [[3]]$var3
#> NULL
#> 
#> [[3]]$var4
#> NULL

Created on 2024-05-15 with reprex v2.1.0

atime.list <- atime::atime(
  N = 2^seq(2,15),
  setup={
    obj = list(
      var1 = 1:N,
      var2 = sample(letters[1:10], size = N, replace = T),
      var3 = list(),
      var4 = list()
    )
  },
  times=10,
  paws.common = paws.common:::transpose(obj),
  purrr = purrr::list_transpose(obj, simplify = F)
)
atime.list |> plot()

image

Fixes: #783

@DyfanJones DyfanJones merged commit 44a320c into paws-r:main May 15, 2024
5 checks passed
@DyfanJones DyfanJones added the bug 🐞 Something isn't working label Jul 3, 2024
@DyfanJones DyfanJones deleted the transpose_list branch July 4, 2024 15:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐞 Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

s3$list_object_versions stopped working
1 participant