Skip to content

map_at() usage in the Chapter 8.3.1 #14

@leynu

Description

@leynu

Hi,

According to the book:

map_at(numbers, c(1, 3), sqrt)

will generate the following output.

## [[1]]
## [1] 2.645751
## 
## [[2]]
## [1] 8
## 
## [[3]]
## [1] 4.358899
## 
## [[4]]
## [1] 64

However, the numbers vector takes values numbers <- c(0, 5, 8, 3, 2, 1)
and the output I get is:

## [[1]]
## [1] 0
## 
## [[2]]
## [1] 5
## 
## [[3]]
## [1] 2.828427
## 
## [[4]]
## [1] 3
## 
## [[5]]
## [1] 2
## 
## [[6]]
## [1] 1

This does make sense since the square root of 0 is 0 and the square root of 8 is 2.828427.

Looking forward to your response.
Thanks,
Leyla

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions