Idiomatic Method of Combining Columns #12481
prairie-guy
started this conversation in
General
Replies: 1 comment 1 reply
-
Im have not 100% understood your requirements, but a more compact way of writing you example is the following: def create-samples [exp_path_csv seq_dir] {
# let samples = (
# get-experiment $exp_path_csv
# | join (get-sequences $seq_dir) SeqID
#)
let samples = [
{SampleID: 1, Std: "std1", other_data: "od1"}
{SampleID: 2, Std: "std2", other_data: "od2"}
]
$samples
| insert FullID {|row| $'($row.SampleID)_($row.Std)'}
} (note that the FullID is now at the end, but is functionally the same and when outputing it you can use |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I’m very new to
nushell,
am am super impressed! I’ve always found stream based computation to be so much clearer and cleaner. Accordingly, I try to avoid for/each constructs whenever possibleMy question is very basic: How does one take contents of two columns, manipulate the contents in a “vector type” manner and create a new column to add to a table. I’ve tried
parse
andformat
but onlyeach
seems to work. For example, in the following code what is thenu
way of doing this without usingeach
?Beta Was this translation helpful? Give feedback.
All reactions