LISTSERV mailing list manager LISTSERV 16.0

Help for R-USERS-L Archives


R-USERS-L Archives

R-USERS-L Archives


R-USERS-L@LISTS.UFL.EDU


View:

Message:

[

First

|

Previous

|

Next

|

Last

]

By Topic:

[

First

|

Previous

|

Next

|

Last

]

By Author:

[

First

|

Previous

|

Next

|

Last

]

Font:

Proportional Font

LISTSERV Archives

LISTSERV Archives

R-USERS-L Home

R-USERS-L Home

R-USERS-L  2018

R-USERS-L 2018

Subject:

Re: How to fill up a column using certain criterias

From:

"Cardoso Carrero,Gabriel" <[log in to unmask]>

Reply-To:

UF R Users List <[log in to unmask]>

Date:

Wed, 20 Jun 2018 00:02:48 +0000

Content-Type:

text/plain

Parts/Attachments:

Parts/Attachments

text/plain (1 lines)

Great Justin, it worked very well, Thanks a lot!

I had to order the column Lot_year to have it from the old to the recent event of deforestation, otherwise it sums up the cumulative proportion in the sequence of the vector (lets say 1990, 2016, 2000….instead of 1990, 2000, 2016).
But I just ordered and it worked pretty well.

Best,

Gabriel

Gabriel C. Carrero
PhD Student
Department of Geography
University of Florida
(352) 888-0234
P.O. Box 117315



On Jun 19, 2018, at 5:03 PM, Millar,Justin J <[log in to unmask]<mailto:[log in to unmask]>> wrote:

dat <- tribble(
 ~ID_LOT, ~YEAR, ~Proportion_DEF, ~cohort, ~lot_year, ~ID_HH, ~A_DEF_PERIOD,
 1,       2015,           0.47,    2015,  "1_2015",   89,       55.473,
 1,       2016,           0.19,    2015,  "1_2016",   89,       22.334,
 2,       2015,           0.71,    2015,  "2_2015",   89,       69.181,
 2,       2016,           0.11,    2015,  "2_2016",   89,       10.202
)

# Create cummulative sum
dat %>%
 group_by(ID_LOT) %>%
 mutate(Cum_prop = cumsum(Proportion_DEF))

Top of Message | Previous Page | Permalink

Advanced Options


Options

Log In

Log In

Get Password

Get Password


Search Archives

Search Archives


Subscribe or Unsubscribe

Subscribe or Unsubscribe


Archives

2019
2018
2017
2016
2015
2014
2013
2012
2011
2010
2009
2008

ATOM RSS1 RSS2



LISTS.UFL.EDU

CataList Email List Search Powered by the LISTSERV Email List Manager