Comments (6)
You could use dplyr's unite for this.
from isoreader.
good idea, I think what unite doesn't do well though is deal with NA
- I imagine a scenario where you have e.g. info x
from one type of IRMS format and info y
from another but you want to work with them as a single id
column: data_frame(x=c(NA, "a"), y = c("b", NA)) %>% unite(id, c(x, y))
creates NA_b
and a_NA
.
Maybe just a case_when
would be easiest, that way the order the columns are provided also determines order of precedence. Maybe something like this with x, y, z dynamically implemented using the unite
syntax?
data_frame(
x=c(NA, "xb", "xc"),
y = c("ya", NA, NA),
z = c("za", "zb", "zc")) %>%
mutate(
id = case_when(
!is.na(x) ~ x,
!is.na(y) ~ y,
!is.na(z) ~ z,
TRUE ~ NA_character_))
from isoreader.
Hmm in that case I don't understand what you want to achieve. This would always pick the first that has a non-na value and ignore further columns, right?
# A tibble: 3 x 4
x y z id
<chr> <chr> <chr> <chr>
1 NA ya za ya
2 xb NA zb xb
3 xc NA zc xc
from isoreader.
This discussion on tidyr's unite may be useful (on how to handle NA's). Maybe just replace the NA
's with ""
, then unite the columns?
from isoreader.
actually implemented this with regular dplyr rename but executed for each isofile separately so recoding to the same column name is easy
from isoreader.
fully implemented in dev version with iso_rename_file_info()
and iso_select_file_info()
and supported in all iso_get...
functions.
from isoreader.
Related Issues (20)
- see if R 3.6 support is feasible HOT 1
- allow `NULL` as name for iso_format to suppress selective exclusion of name
- iso_get_raw_data's include_file_info column repeats first value HOT 2
- read component from IsoDat .dxf files HOT 6
- issue reading termination sequence of a dxf file HOT 1
- implement support for reading Sercon Integra 2 files HOT 3
- fix futures warning in parallel processing HOT 1
- allow factors in file info
- switching file info inside a run to account for injection skips HOT 1
- 'iso_get_vendor_data_table' unable to select manually edited peak rows from .dxf files HOT 2
- support for elementar ionOS .iarc version 3 HOT 2
- rename `iso_export_to_excel` to `iso_export_files_to_excel` to avoid ambiguity HOT 1
- units for vendor data table from .did dual inlet files are not read out
- update readme and DESCRIPTION with info about JOSS paper HOT 1
- finally retire plotting functions (have been deprecated and moved to isoprocessor for a while) HOT 1
- CRAN version unavailable HOT 2
- use apache arrow for feather/parquet instead of feather directly
- implement C++ or rust backend for isoreader
- Can't read odd .did files
- vendor data table precision differences error
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from isoreader.