-1

In a function I created, at the end of the process I need to find the maxima of the data.

In this screenshot,[the values' name are [ 1 ]],[[ 2 ]] etc. r screenshot

And when I export them to excel, values are getting complicated. excel screenshot

For example; I want to give 'two hours' name to [1] And I want to see these names in the excel sheet.

NelsonGon
  • 13,015
  • 7
  • 27
  • 57
  • 4
    Please edit this, past and future questions as stated [here](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example). – NelsonGon Mar 17 '19 at 16:54

1 Answers1

0

Just set the names() of your list...

(x <- list(1, 2, 3, 4, 5)) # an unnamed list
[[1]]
[1] 1

[[2]]
[1] 2

[[3]]
[1] 3

[[4]]
[1] 4

[[5]]
[1] 5

names(x) <- c("a", "b", "c", "d", "e") # set list names to vector of names
x
$`a`
[1] 1

$b
[1] 2

$c
[1] 3

$d
[1] 4

$e
[1] 5

However, the best way to do this depends on your function - which you haven't provided...

ha-pu
  • 581
  • 7
  • 19