I have a list of names and categories, as follows:
Name
Country
Role
Type
Position
A
USA
P
I
SZ
B
India
R
E
DS
C
USA
H
I
FG
D
France
P
S
RTG
E
USA
R
I
ZA
F
India
H
E
SFG
G
USA
Z
I
DFZ
H
France
Z
S
FSZ
And I would like to put it as follows with R
Column1 Column2 Column3 Column4 Column5
A USA P I SZ
B India R E DS
C USA H I FG
D France P S RTG
E USA R I ZA
F India H E SFG
G USA Z I DFZ
H France Z S FSZ
I know how to do it in Excel, using the following formula:
=INDEX($A:$A,ROW(A1)*5-5+COLUMN(A1))
I have no idea how to do it in R.
Thanks