r - Reshaping data.frame from wide to long format -
I have a problem with changing my data.frame
in a long table from a large table At the moment it looks like this:
wide & lt; - read.table (textConnection ("Code Country 1950 1951 1952 1953 1954 AFG Afghanistan 20.249 21.352 22.532 23.557 24.555 ALB Albania 8.097 8.986 10.058 11.123 12.246 Which Production Data. Frame Detailed
Looks like this: Code country 1950 1951 1952 1953 1954 AFG Afghanistan 20.249 21.352 22.532 23.557 24.555 ALB Albania 8.097 8.986 10.058 11.123 12.246
< P> I want to change wide
in a long for example.
for example: code country year value AFG Afghanistan 1950 20249 AFG Afghanistan 1951 21352 AFG Afghanistan 1952 22 , 532 AFG Afghanistan 1953 23,557 AFG Afghanistan 1954 24,555 ALB Albania 1950 8097 ALB Albania 1951 8986 ALB Albania 1952 10,058 ALB Albania 1953 11,123 ALB Albania 1954 12,246 In the form of 2016, options are included reshape2 :: melt ()
, as well as tidyr :: assemble ()
and data.table :: melt ()
solution and old Reshape :: reshape ()
function. However, till now I only get dirty results in an attempt to use these multiple simultaneous functions. If this is possible, then I have to handle it a little good since the reshape ()
function, but to use the appreciation of other packages for example / Feeling Resnells. After the "text" itemprop = "text">
reshape ()
takes some time, like
d :
Comments
Post a Comment