water-supply | reservoir data http : //cdec | Dataset library
kandi X-RAY | water-supply Summary
kandi X-RAY | water-supply Summary
reservoir data (location, id, name) reservoir data (capacities) shapefiles cor california counties:
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of water-supply
water-supply Key Features
water-supply Examples and Code Snippets
Community Discussions
Trending Discussions on water-supply
QUESTION
I am currently working with a dataset containing the records of some water-supply tanks that shows the DATE of technical inspections of 5 different tanks (IDENT) and also the TYPE of inspection recorded which can only have two values "READ" when the tank is working properly and "ERROR" when otherwise performing poorly.
IDENT DATE TYPE X3 30/04/2021 ERROR X1 1/05/2021 READ X1 2/05/2021 ERROR X4 3/05/2021 READ X9 4/05/2021 ERROR X6 5/05/2021 READ X1 6/05/2021 READ X3 7/05/2021 ERROR X3 8/05/2021 READI have to create a dataframe that can filter and select every TYPE="ERROR" DATE for each water tank (is there is no error recorded on the dateset for a specify tank is not necessary to show it) and show the latest TYPE="READ" DATE prior to the each tank's ERROR and also the latest DATE After each tank's error date, to illustrate I am to achieve this table:
...ANSWER
Answered 2021-Apr-30 at 19:32We convert the 'DATE' column to Date
class (dmy
- from lubridate), arrange
the rows by 'IDENT' and 'DATE', grouped by 'IDENT', recode the 'READ' values to 'READ_PRIOR' and 'POST_READ' with case_when
based on the presence of 'ERROR', remove the 'IDENT' groups that have no 'ERROR' value in 'TYPE', reshape to 'wide' format with pivot_wider
and fill
the values in 'POST_READ' with non-NA adjacent values for each 'IDENT'
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install water-supply
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page