Tente assim:
transform(reshape(x, direction = "long", varying = list(-1)),
REP = gsub("AF\\d", "", names(x)[-1]),
AF = gsub("MEDIDA\\d+", "", names(x)[-1]),
time = NULL, id = NULL)
2011/8/25 Greice Laureano <[email protected]>
>
> Bom dia,
>
> Gostaria de ajuda no seguinte problema:
>
> Tenho a um conjunto de dados assim:
>
> ID AF1MEDIDA1 AF1MEDIDA2 AF2MEDIDA1 AF2MEDIDA2 AF3MEDIDA1 AF3MEDIDA2
> 1 11.7 5.0 21.7 21.0 33.0 20.3
>
> E gostaria de transformar ele nesse tipo:
>
>
> ID REP AF VALOR
> 1 MEDIDA1 AF1 11.7
> 1 MEDIDA2 AF1 5
> 1 MEDIDA1 AF2 21
> 1 MEDIDA2 AF2 21
> 1 MEDIDA1 AF3 33
> 1 MEDIDA2 AF3 20.03
>
> Obrigado,
> Att,
> Greice.
>
>
>
>
>
> _______________________________________________
> R-br mailing list
> [email protected]
> https://listas.inf.ufpr.br/cgi-bin/mailman/listinfo/r-br
> Leia o guia de postagem (http://www.leg.ufpr.br/r-br-guia) e forneça código
> mínimo reproduzível.
--
Henrique Dallazuanna
Curitiba-Paraná-Brasil
25° 25' 40" S 49° 16' 22" O
_______________________________________________
R-br mailing list
[email protected]
https://listas.inf.ufpr.br/cgi-bin/mailman/listinfo/r-br
Leia o guia de postagem (http://www.leg.ufpr.br/r-br-guia) e forneça código
mínimo reproduzível.