Using dplR, I am attempting to read site, tree, and core IDs from a ring width length data.frame
I am attempting to sort samples based on a 6, and occasionally 7, digit code. I am running into an issue when I have a 7 digit codes.
examples of my naming system:
jT1-1A
jT1-1B
iT2-1A
iT2-1B
iT2-2A
iT2-2B
rT2-10A
rT2-10B
The first four digits represent the "site", the next digit (sometimes 2 digits) represents the "individual", finally, A or B represents the specimen (most individuals have both A and B). Ultimately, I am attempting to sort and then average the samples that have two specimens.
library(dplR)
bb_pixx <- read.tucson('ButteLake_Burn_PIXX_FINAL_DATED.TXT', header = NULL, long = FALSE, encoding = getOption("encoding"), edge.zeros = TRUE)
##Calulate mean across cores in a tree
bb_pixx.ids <- read.ids(bb_pixx, stc = c(4, 1, 1), ignore.site.case = TRUE)
How can I write code to account for the occasional 2 digit number?
Hopefully this is clear enough.
r
|
show 2 more comments
I am attempting to sort samples based on a 6, and occasionally 7, digit code. I am running into an issue when I have a 7 digit codes.
examples of my naming system:
jT1-1A
jT1-1B
iT2-1A
iT2-1B
iT2-2A
iT2-2B
rT2-10A
rT2-10B
The first four digits represent the "site", the next digit (sometimes 2 digits) represents the "individual", finally, A or B represents the specimen (most individuals have both A and B). Ultimately, I am attempting to sort and then average the samples that have two specimens.
library(dplR)
bb_pixx <- read.tucson('ButteLake_Burn_PIXX_FINAL_DATED.TXT', header = NULL, long = FALSE, encoding = getOption("encoding"), edge.zeros = TRUE)
##Calulate mean across cores in a tree
bb_pixx.ids <- read.ids(bb_pixx, stc = c(4, 1, 1), ignore.site.case = TRUE)
How can I write code to account for the occasional 2 digit number?
Hopefully this is clear enough.
r
What do you mean by "account for" the digit? What exactly doesn't the current code do that you need it to do? Or what output do you need?
– MrFlick
Nov 19 at 21:44
When I use the current code, it is sorting by site just fine(first four digits) then it is only sorting the by the next digit (in which i need it to sort by 2 when my number is two digits, but only one when it is one digit).
– Zach
Nov 19 at 21:47
and then finally, sort by A or B, which it is doing already.
– Zach
Nov 19 at 21:47
So this is just a question about sorting your raw data?
– MrFlick
Nov 19 at 21:48
So, if i write the code to sort by c(4,2,1), this causes issues when the naming is only 6 characters
– Zach
Nov 19 at 21:50
|
show 2 more comments
I am attempting to sort samples based on a 6, and occasionally 7, digit code. I am running into an issue when I have a 7 digit codes.
examples of my naming system:
jT1-1A
jT1-1B
iT2-1A
iT2-1B
iT2-2A
iT2-2B
rT2-10A
rT2-10B
The first four digits represent the "site", the next digit (sometimes 2 digits) represents the "individual", finally, A or B represents the specimen (most individuals have both A and B). Ultimately, I am attempting to sort and then average the samples that have two specimens.
library(dplR)
bb_pixx <- read.tucson('ButteLake_Burn_PIXX_FINAL_DATED.TXT', header = NULL, long = FALSE, encoding = getOption("encoding"), edge.zeros = TRUE)
##Calulate mean across cores in a tree
bb_pixx.ids <- read.ids(bb_pixx, stc = c(4, 1, 1), ignore.site.case = TRUE)
How can I write code to account for the occasional 2 digit number?
Hopefully this is clear enough.
r
I am attempting to sort samples based on a 6, and occasionally 7, digit code. I am running into an issue when I have a 7 digit codes.
examples of my naming system:
jT1-1A
jT1-1B
iT2-1A
iT2-1B
iT2-2A
iT2-2B
rT2-10A
rT2-10B
The first four digits represent the "site", the next digit (sometimes 2 digits) represents the "individual", finally, A or B represents the specimen (most individuals have both A and B). Ultimately, I am attempting to sort and then average the samples that have two specimens.
library(dplR)
bb_pixx <- read.tucson('ButteLake_Burn_PIXX_FINAL_DATED.TXT', header = NULL, long = FALSE, encoding = getOption("encoding"), edge.zeros = TRUE)
##Calulate mean across cores in a tree
bb_pixx.ids <- read.ids(bb_pixx, stc = c(4, 1, 1), ignore.site.case = TRUE)
How can I write code to account for the occasional 2 digit number?
Hopefully this is clear enough.
r
r
edited Nov 19 at 21:46
MrFlick
119k11130161
119k11130161
asked Nov 19 at 21:41
Zach
1
1
What do you mean by "account for" the digit? What exactly doesn't the current code do that you need it to do? Or what output do you need?
– MrFlick
Nov 19 at 21:44
When I use the current code, it is sorting by site just fine(first four digits) then it is only sorting the by the next digit (in which i need it to sort by 2 when my number is two digits, but only one when it is one digit).
– Zach
Nov 19 at 21:47
and then finally, sort by A or B, which it is doing already.
– Zach
Nov 19 at 21:47
So this is just a question about sorting your raw data?
– MrFlick
Nov 19 at 21:48
So, if i write the code to sort by c(4,2,1), this causes issues when the naming is only 6 characters
– Zach
Nov 19 at 21:50
|
show 2 more comments
What do you mean by "account for" the digit? What exactly doesn't the current code do that you need it to do? Or what output do you need?
– MrFlick
Nov 19 at 21:44
When I use the current code, it is sorting by site just fine(first four digits) then it is only sorting the by the next digit (in which i need it to sort by 2 when my number is two digits, but only one when it is one digit).
– Zach
Nov 19 at 21:47
and then finally, sort by A or B, which it is doing already.
– Zach
Nov 19 at 21:47
So this is just a question about sorting your raw data?
– MrFlick
Nov 19 at 21:48
So, if i write the code to sort by c(4,2,1), this causes issues when the naming is only 6 characters
– Zach
Nov 19 at 21:50
What do you mean by "account for" the digit? What exactly doesn't the current code do that you need it to do? Or what output do you need?
– MrFlick
Nov 19 at 21:44
What do you mean by "account for" the digit? What exactly doesn't the current code do that you need it to do? Or what output do you need?
– MrFlick
Nov 19 at 21:44
When I use the current code, it is sorting by site just fine(first four digits) then it is only sorting the by the next digit (in which i need it to sort by 2 when my number is two digits, but only one when it is one digit).
– Zach
Nov 19 at 21:47
When I use the current code, it is sorting by site just fine(first four digits) then it is only sorting the by the next digit (in which i need it to sort by 2 when my number is two digits, but only one when it is one digit).
– Zach
Nov 19 at 21:47
and then finally, sort by A or B, which it is doing already.
– Zach
Nov 19 at 21:47
and then finally, sort by A or B, which it is doing already.
– Zach
Nov 19 at 21:47
So this is just a question about sorting your raw data?
– MrFlick
Nov 19 at 21:48
So this is just a question about sorting your raw data?
– MrFlick
Nov 19 at 21:48
So, if i write the code to sort by c(4,2,1), this causes issues when the naming is only 6 characters
– Zach
Nov 19 at 21:50
So, if i write the code to sort by c(4,2,1), this causes issues when the naming is only 6 characters
– Zach
Nov 19 at 21:50
|
show 2 more comments
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53383043%2fusing-dplr-i-am-attempting-to-read-site-tree-and-core-ids-from-a-ring-width-l%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53383043%2fusing-dplr-i-am-attempting-to-read-site-tree-and-core-ids-from-a-ring-width-l%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
What do you mean by "account for" the digit? What exactly doesn't the current code do that you need it to do? Or what output do you need?
– MrFlick
Nov 19 at 21:44
When I use the current code, it is sorting by site just fine(first four digits) then it is only sorting the by the next digit (in which i need it to sort by 2 when my number is two digits, but only one when it is one digit).
– Zach
Nov 19 at 21:47
and then finally, sort by A or B, which it is doing already.
– Zach
Nov 19 at 21:47
So this is just a question about sorting your raw data?
– MrFlick
Nov 19 at 21:48
So, if i write the code to sort by c(4,2,1), this causes issues when the naming is only 6 characters
– Zach
Nov 19 at 21:50