Skip to content

Commit

Permalink
fix reshape in base r
Browse files Browse the repository at this point in the history
  • Loading branch information
natashawatkins committed May 29, 2018
1 parent f4efedd commit 9c977f0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions stats-cheatsheet.rst
Original file line number Diff line number Diff line change
Expand Up @@ -148,11 +148,11 @@ Reshaping data
+======================================+=============================+============================================+====================================================================================+
| | .. code-block:: stata | .. code-block:: python | .. code-block:: r |
| | | | |
| Reshape data from wide to long panel | reshape long x, i(i) j(j) | pd.wide_to_long(df, ['x'], i='i', j='j') | reshape(df, direction=long, varying=grep(‘x’, names(df), value=TRUE), sep='') |
| Reshape data from wide to long panel | reshape long x, i(i) j(j) | pd.wide_to_long(df, ['x'], i='i', j='j') | reshape(df, direction='long', varying=grep('j', names(df), value=TRUE), sep='') |
+--------------------------------------+-----------------------------+--------------------------------------------+------------------------------------------------------------------------------------+
| | .. code-block:: stata | .. code-block:: python | .. code-block:: r |
| | | | |
| Reshape data from long to wide panel | reshape wide | df.unstack() | reshape(df, direction='wide', varying=x, value=TRUE), sep='') |
| Reshape data from long to wide panel | reshape wide | df.unstack() | reshape(df, timevar='x', idvar='i', direction='wide') |
| | | | |
| | | # returns hierarchical columns | |
+--------------------------------------+-----------------------------+--------------------------------------------+------------------------------------------------------------------------------------+
Expand Down

0 comments on commit 9c977f0

Please sign in to comment.