Is there a way to create a dataframe from an array of keys and array of values?
How do I create a data.frame
from the following keys and values?
keys = letters[1:5]
values = array(1:50, dim=c(10, 5))
Is there a way to create a dataframe from an array of keys and array of values?
How do I create a data.frame
from the following keys and values?
keys = letters[1:5]
values = array(1:50, dim=c(10, 5))
*How" may not be the right question if the intent is to create a hash.
(data.frame(keys = letters[1:5],values = array(1:50, dim=c(10, 5))))
#> keys values.1 values.2 values.3 values.4 values.5
#> 1 a 1 11 21 31 41
#> 2 b 2 12 22 32 42
#> 3 c 3 13 23 33 43
#> 4 d 4 14 24 34 44
#> 5 e 5 15 25 35 45
#> 6 a 6 16 26 36 46
#> 7 b 7 17 27 37 47
#> 8 c 8 18 28 38 48
#> 9 d 9 19 29 39 49
#> 10 e 10 20 30 40 50
Created on 2023-03-31 with reprex v2.0.2
This topic was automatically closed 42 days after the last reply. New replies are no longer allowed.
If you have a query related to it or one of the replies, start a new topic and refer back with a link.