Read in .xrdml data within a complex array












5















I'm trying to read several files of type ".xrdml" and combine them into a single dataframe with an intuitive label. The problem is that this file type has a large metadata.



I've tried the following



Required package



library(rxylib)


Things i tried



temp = list.files(pattern="*.xrdml")
xyz<-do.call(rbind,sapply(temp, read_xyData,verbose = TRUE,metaData = FALSE))


i ended up with a list, i can call each member of the list using for example xyz[[2]]



          2Theta    V2
[1,] 4.006565 3496
[2,] 4.019695 3417
[3,] 4.032826 3520
[4,] 4.045956 3516
[5,] 4.059086 3480
[6,] 4.072217 3343
[7,] 4.085347 3466
[8,] 4.098477 3552
[9,] 4.111607 3425
[10,] 4.124738 3384


if i try to flatten the list by using the unlist function, then the result becomes messy



what i will like to do is to read in all the files and combine them by column, each file has first column in common i.e 2Theta . i will also like to use the unique part of each file title to label V2



my files have titles like "BBHD-FASS_4-70_step01_40s_LM 11_5.xrdml". what i hope to be able to do at the end is to have a dataframe similar to the sample below



2Theta   LM 6-26  LM 6-27  LM 6-28 LM 4-10 LM 4-11 LM 4-12
4.006565 3576 3535 3677 3576 3535 3677
4.019695 3526 3552 3662 3526 3552 3662
4.032826 3584 3581 3657 3584 3581 3657
4.045956 3489 3535 3539 3489 3535 3539
4.059086 3496 3507 3525 3496 3507 3525
4.072217 3335 3466 3628 3335 3466 3628
4.085347 3353 3456 3444 3353 3456 3444
4.098477 3430 3479 3588 3430 3479 3588
4.111607 3334 3547 3535 3334 3547 3535
4.124738 3424 3342 3439 3424 3342 3439
4.137868 3349 3384 3459 3349 3384 3459
4.150998 3318 3395 3413 3318 3395 3413
4.164129 3208 3490 3457 3208 3490 3457
4.177259 3357 3295 3519 3357 3295 3519
4.190389 3254 3372 3450 3254 3372 3450


Here are samples of my files sample files



Sadly, i've spent so much time already trying several things which didn't work.



I'll be very grateful for any help or guidance i can get on how to approach this problem.










share|improve this question





























    5















    I'm trying to read several files of type ".xrdml" and combine them into a single dataframe with an intuitive label. The problem is that this file type has a large metadata.



    I've tried the following



    Required package



    library(rxylib)


    Things i tried



    temp = list.files(pattern="*.xrdml")
    xyz<-do.call(rbind,sapply(temp, read_xyData,verbose = TRUE,metaData = FALSE))


    i ended up with a list, i can call each member of the list using for example xyz[[2]]



              2Theta    V2
    [1,] 4.006565 3496
    [2,] 4.019695 3417
    [3,] 4.032826 3520
    [4,] 4.045956 3516
    [5,] 4.059086 3480
    [6,] 4.072217 3343
    [7,] 4.085347 3466
    [8,] 4.098477 3552
    [9,] 4.111607 3425
    [10,] 4.124738 3384


    if i try to flatten the list by using the unlist function, then the result becomes messy



    what i will like to do is to read in all the files and combine them by column, each file has first column in common i.e 2Theta . i will also like to use the unique part of each file title to label V2



    my files have titles like "BBHD-FASS_4-70_step01_40s_LM 11_5.xrdml". what i hope to be able to do at the end is to have a dataframe similar to the sample below



    2Theta   LM 6-26  LM 6-27  LM 6-28 LM 4-10 LM 4-11 LM 4-12
    4.006565 3576 3535 3677 3576 3535 3677
    4.019695 3526 3552 3662 3526 3552 3662
    4.032826 3584 3581 3657 3584 3581 3657
    4.045956 3489 3535 3539 3489 3535 3539
    4.059086 3496 3507 3525 3496 3507 3525
    4.072217 3335 3466 3628 3335 3466 3628
    4.085347 3353 3456 3444 3353 3456 3444
    4.098477 3430 3479 3588 3430 3479 3588
    4.111607 3334 3547 3535 3334 3547 3535
    4.124738 3424 3342 3439 3424 3342 3439
    4.137868 3349 3384 3459 3349 3384 3459
    4.150998 3318 3395 3413 3318 3395 3413
    4.164129 3208 3490 3457 3208 3490 3457
    4.177259 3357 3295 3519 3357 3295 3519
    4.190389 3254 3372 3450 3254 3372 3450


    Here are samples of my files sample files



    Sadly, i've spent so much time already trying several things which didn't work.



    I'll be very grateful for any help or guidance i can get on how to approach this problem.










    share|improve this question



























      5












      5








      5








      I'm trying to read several files of type ".xrdml" and combine them into a single dataframe with an intuitive label. The problem is that this file type has a large metadata.



      I've tried the following



      Required package



      library(rxylib)


      Things i tried



      temp = list.files(pattern="*.xrdml")
      xyz<-do.call(rbind,sapply(temp, read_xyData,verbose = TRUE,metaData = FALSE))


      i ended up with a list, i can call each member of the list using for example xyz[[2]]



                2Theta    V2
      [1,] 4.006565 3496
      [2,] 4.019695 3417
      [3,] 4.032826 3520
      [4,] 4.045956 3516
      [5,] 4.059086 3480
      [6,] 4.072217 3343
      [7,] 4.085347 3466
      [8,] 4.098477 3552
      [9,] 4.111607 3425
      [10,] 4.124738 3384


      if i try to flatten the list by using the unlist function, then the result becomes messy



      what i will like to do is to read in all the files and combine them by column, each file has first column in common i.e 2Theta . i will also like to use the unique part of each file title to label V2



      my files have titles like "BBHD-FASS_4-70_step01_40s_LM 11_5.xrdml". what i hope to be able to do at the end is to have a dataframe similar to the sample below



      2Theta   LM 6-26  LM 6-27  LM 6-28 LM 4-10 LM 4-11 LM 4-12
      4.006565 3576 3535 3677 3576 3535 3677
      4.019695 3526 3552 3662 3526 3552 3662
      4.032826 3584 3581 3657 3584 3581 3657
      4.045956 3489 3535 3539 3489 3535 3539
      4.059086 3496 3507 3525 3496 3507 3525
      4.072217 3335 3466 3628 3335 3466 3628
      4.085347 3353 3456 3444 3353 3456 3444
      4.098477 3430 3479 3588 3430 3479 3588
      4.111607 3334 3547 3535 3334 3547 3535
      4.124738 3424 3342 3439 3424 3342 3439
      4.137868 3349 3384 3459 3349 3384 3459
      4.150998 3318 3395 3413 3318 3395 3413
      4.164129 3208 3490 3457 3208 3490 3457
      4.177259 3357 3295 3519 3357 3295 3519
      4.190389 3254 3372 3450 3254 3372 3450


      Here are samples of my files sample files



      Sadly, i've spent so much time already trying several things which didn't work.



      I'll be very grateful for any help or guidance i can get on how to approach this problem.










      share|improve this question
















      I'm trying to read several files of type ".xrdml" and combine them into a single dataframe with an intuitive label. The problem is that this file type has a large metadata.



      I've tried the following



      Required package



      library(rxylib)


      Things i tried



      temp = list.files(pattern="*.xrdml")
      xyz<-do.call(rbind,sapply(temp, read_xyData,verbose = TRUE,metaData = FALSE))


      i ended up with a list, i can call each member of the list using for example xyz[[2]]



                2Theta    V2
      [1,] 4.006565 3496
      [2,] 4.019695 3417
      [3,] 4.032826 3520
      [4,] 4.045956 3516
      [5,] 4.059086 3480
      [6,] 4.072217 3343
      [7,] 4.085347 3466
      [8,] 4.098477 3552
      [9,] 4.111607 3425
      [10,] 4.124738 3384


      if i try to flatten the list by using the unlist function, then the result becomes messy



      what i will like to do is to read in all the files and combine them by column, each file has first column in common i.e 2Theta . i will also like to use the unique part of each file title to label V2



      my files have titles like "BBHD-FASS_4-70_step01_40s_LM 11_5.xrdml". what i hope to be able to do at the end is to have a dataframe similar to the sample below



      2Theta   LM 6-26  LM 6-27  LM 6-28 LM 4-10 LM 4-11 LM 4-12
      4.006565 3576 3535 3677 3576 3535 3677
      4.019695 3526 3552 3662 3526 3552 3662
      4.032826 3584 3581 3657 3584 3581 3657
      4.045956 3489 3535 3539 3489 3535 3539
      4.059086 3496 3507 3525 3496 3507 3525
      4.072217 3335 3466 3628 3335 3466 3628
      4.085347 3353 3456 3444 3353 3456 3444
      4.098477 3430 3479 3588 3430 3479 3588
      4.111607 3334 3547 3535 3334 3547 3535
      4.124738 3424 3342 3439 3424 3342 3439
      4.137868 3349 3384 3459 3349 3384 3459
      4.150998 3318 3395 3413 3318 3395 3413
      4.164129 3208 3490 3457 3208 3490 3457
      4.177259 3357 3295 3519 3357 3295 3519
      4.190389 3254 3372 3450 3254 3372 3450


      Here are samples of my files sample files



      Sadly, i've spent so much time already trying several things which didn't work.



      I'll be very grateful for any help or guidance i can get on how to approach this problem.







      r arraylist customization






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 19 '18 at 18:08









      user20650

      17k43367




      17k43367










      asked Sep 2 '18 at 5:37









      HammaoHammao

      155313




      155313
























          1 Answer
          1






          active

          oldest

          votes


















          4





          +50









          To get to the data you need to find the correct position in the list of data that is returned by read_xyData. You can do this by looking at str(lst) below. To get to the data use ...$dataset[[1]]$data_block. (there may be extractor functions in the package but I have not checked)



          # download data : link dead
          #download.file("https://ucc93bf0aa50821e11b95c9530f5.dl.dropboxusercontent.com/zip_by_token_key?_download_id=9101556320431172280658295109635067362614982268430911643523348&_notify_domain=www.dropbox.com&dl=1&key=AV5mxk0trnetzASlH9_xJijTiGE55mUz0qa-x7JveZ7-Rdp3Z8i7GmwwQoWj8tUO14RKj51huhb5CuBdoxAC3WLuHvOMr7_bul691AmGpmwZgWWy0STezjFRnq0CVUR-iHNnZUHk9-t-i72nYODDpjXvo0PBhWTXwJuNWCSL4bnAauZREQtZwzNlspMF8PwZ37E9enf1WUUakLJwE43GbV2lAkuOTDghfcMmwokulIMEGA", destfile=temp<-tempfile())
          unzip(temp, exdir=xdir<-tempdir())

          nms <- list.files(xdir, pattern="xrdml", full.names=TRUE)
          # grab the names to names columns later
          cnms <- gsub(".*(LM \w+).*$", "\1", basename(nms))


          library(rxylib)

          # loop through files to read in
          lst <- lapply(nms, read_xyData, verbose = TRUE, metaData = FALSE)

          # grab the data
          dats <- lapply(lst, function(x) x$dataset[[1]]$data_block)

          # rename second column
          dats <- lapply(seq_along(dats), function(x) {
          colnames(dats[[x]])[2] <- cnms[x] ; dats[[x]]})

          # merge
          alldat <- Reduce(function(...) merge(..., by="2Theta"), dats)





          share|improve this answer


























          • Thanks for taking out time to help out with this... i added just a line of code to read in the file because the unzip failed path = "~/MEGA/R/Spectral_Files/Spectral_Files/Data" nms <- list.files(path, pattern="xrdml", full.names=TRUE) . Also the labelling doesn't work as expected because my files can different suffixes not only "LM". I tried modifying the gsub() but got error each time. It will be highly appreciated if you can help with this.

            – Hammao
            Nov 20 '18 at 20:40













          • you're welcome. re the names, you could try gsub(".*_(\w+ \w+).*$", "\1", basename(nms)) but I think it is better asking for help with this in a new question -- get the regrex folks eyes on it. (ps best to add a small sample of different potential names from basename(nms) to try and get all edge cases)

            – user20650
            Nov 20 '18 at 20:58








          • 1





            Thanks ... it worked for all file types, !!! I wish i have your type of knowledge in base r

            – Hammao
            Nov 20 '18 at 22:59











          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
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f52134277%2fread-in-xrdml-data-within-a-complex-array%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          4





          +50









          To get to the data you need to find the correct position in the list of data that is returned by read_xyData. You can do this by looking at str(lst) below. To get to the data use ...$dataset[[1]]$data_block. (there may be extractor functions in the package but I have not checked)



          # download data : link dead
          #download.file("https://ucc93bf0aa50821e11b95c9530f5.dl.dropboxusercontent.com/zip_by_token_key?_download_id=9101556320431172280658295109635067362614982268430911643523348&_notify_domain=www.dropbox.com&dl=1&key=AV5mxk0trnetzASlH9_xJijTiGE55mUz0qa-x7JveZ7-Rdp3Z8i7GmwwQoWj8tUO14RKj51huhb5CuBdoxAC3WLuHvOMr7_bul691AmGpmwZgWWy0STezjFRnq0CVUR-iHNnZUHk9-t-i72nYODDpjXvo0PBhWTXwJuNWCSL4bnAauZREQtZwzNlspMF8PwZ37E9enf1WUUakLJwE43GbV2lAkuOTDghfcMmwokulIMEGA", destfile=temp<-tempfile())
          unzip(temp, exdir=xdir<-tempdir())

          nms <- list.files(xdir, pattern="xrdml", full.names=TRUE)
          # grab the names to names columns later
          cnms <- gsub(".*(LM \w+).*$", "\1", basename(nms))


          library(rxylib)

          # loop through files to read in
          lst <- lapply(nms, read_xyData, verbose = TRUE, metaData = FALSE)

          # grab the data
          dats <- lapply(lst, function(x) x$dataset[[1]]$data_block)

          # rename second column
          dats <- lapply(seq_along(dats), function(x) {
          colnames(dats[[x]])[2] <- cnms[x] ; dats[[x]]})

          # merge
          alldat <- Reduce(function(...) merge(..., by="2Theta"), dats)





          share|improve this answer


























          • Thanks for taking out time to help out with this... i added just a line of code to read in the file because the unzip failed path = "~/MEGA/R/Spectral_Files/Spectral_Files/Data" nms <- list.files(path, pattern="xrdml", full.names=TRUE) . Also the labelling doesn't work as expected because my files can different suffixes not only "LM". I tried modifying the gsub() but got error each time. It will be highly appreciated if you can help with this.

            – Hammao
            Nov 20 '18 at 20:40













          • you're welcome. re the names, you could try gsub(".*_(\w+ \w+).*$", "\1", basename(nms)) but I think it is better asking for help with this in a new question -- get the regrex folks eyes on it. (ps best to add a small sample of different potential names from basename(nms) to try and get all edge cases)

            – user20650
            Nov 20 '18 at 20:58








          • 1





            Thanks ... it worked for all file types, !!! I wish i have your type of knowledge in base r

            – Hammao
            Nov 20 '18 at 22:59
















          4





          +50









          To get to the data you need to find the correct position in the list of data that is returned by read_xyData. You can do this by looking at str(lst) below. To get to the data use ...$dataset[[1]]$data_block. (there may be extractor functions in the package but I have not checked)



          # download data : link dead
          #download.file("https://ucc93bf0aa50821e11b95c9530f5.dl.dropboxusercontent.com/zip_by_token_key?_download_id=9101556320431172280658295109635067362614982268430911643523348&_notify_domain=www.dropbox.com&dl=1&key=AV5mxk0trnetzASlH9_xJijTiGE55mUz0qa-x7JveZ7-Rdp3Z8i7GmwwQoWj8tUO14RKj51huhb5CuBdoxAC3WLuHvOMr7_bul691AmGpmwZgWWy0STezjFRnq0CVUR-iHNnZUHk9-t-i72nYODDpjXvo0PBhWTXwJuNWCSL4bnAauZREQtZwzNlspMF8PwZ37E9enf1WUUakLJwE43GbV2lAkuOTDghfcMmwokulIMEGA", destfile=temp<-tempfile())
          unzip(temp, exdir=xdir<-tempdir())

          nms <- list.files(xdir, pattern="xrdml", full.names=TRUE)
          # grab the names to names columns later
          cnms <- gsub(".*(LM \w+).*$", "\1", basename(nms))


          library(rxylib)

          # loop through files to read in
          lst <- lapply(nms, read_xyData, verbose = TRUE, metaData = FALSE)

          # grab the data
          dats <- lapply(lst, function(x) x$dataset[[1]]$data_block)

          # rename second column
          dats <- lapply(seq_along(dats), function(x) {
          colnames(dats[[x]])[2] <- cnms[x] ; dats[[x]]})

          # merge
          alldat <- Reduce(function(...) merge(..., by="2Theta"), dats)





          share|improve this answer


























          • Thanks for taking out time to help out with this... i added just a line of code to read in the file because the unzip failed path = "~/MEGA/R/Spectral_Files/Spectral_Files/Data" nms <- list.files(path, pattern="xrdml", full.names=TRUE) . Also the labelling doesn't work as expected because my files can different suffixes not only "LM". I tried modifying the gsub() but got error each time. It will be highly appreciated if you can help with this.

            – Hammao
            Nov 20 '18 at 20:40













          • you're welcome. re the names, you could try gsub(".*_(\w+ \w+).*$", "\1", basename(nms)) but I think it is better asking for help with this in a new question -- get the regrex folks eyes on it. (ps best to add a small sample of different potential names from basename(nms) to try and get all edge cases)

            – user20650
            Nov 20 '18 at 20:58








          • 1





            Thanks ... it worked for all file types, !!! I wish i have your type of knowledge in base r

            – Hammao
            Nov 20 '18 at 22:59














          4





          +50







          4





          +50



          4




          +50





          To get to the data you need to find the correct position in the list of data that is returned by read_xyData. You can do this by looking at str(lst) below. To get to the data use ...$dataset[[1]]$data_block. (there may be extractor functions in the package but I have not checked)



          # download data : link dead
          #download.file("https://ucc93bf0aa50821e11b95c9530f5.dl.dropboxusercontent.com/zip_by_token_key?_download_id=9101556320431172280658295109635067362614982268430911643523348&_notify_domain=www.dropbox.com&dl=1&key=AV5mxk0trnetzASlH9_xJijTiGE55mUz0qa-x7JveZ7-Rdp3Z8i7GmwwQoWj8tUO14RKj51huhb5CuBdoxAC3WLuHvOMr7_bul691AmGpmwZgWWy0STezjFRnq0CVUR-iHNnZUHk9-t-i72nYODDpjXvo0PBhWTXwJuNWCSL4bnAauZREQtZwzNlspMF8PwZ37E9enf1WUUakLJwE43GbV2lAkuOTDghfcMmwokulIMEGA", destfile=temp<-tempfile())
          unzip(temp, exdir=xdir<-tempdir())

          nms <- list.files(xdir, pattern="xrdml", full.names=TRUE)
          # grab the names to names columns later
          cnms <- gsub(".*(LM \w+).*$", "\1", basename(nms))


          library(rxylib)

          # loop through files to read in
          lst <- lapply(nms, read_xyData, verbose = TRUE, metaData = FALSE)

          # grab the data
          dats <- lapply(lst, function(x) x$dataset[[1]]$data_block)

          # rename second column
          dats <- lapply(seq_along(dats), function(x) {
          colnames(dats[[x]])[2] <- cnms[x] ; dats[[x]]})

          # merge
          alldat <- Reduce(function(...) merge(..., by="2Theta"), dats)





          share|improve this answer















          To get to the data you need to find the correct position in the list of data that is returned by read_xyData. You can do this by looking at str(lst) below. To get to the data use ...$dataset[[1]]$data_block. (there may be extractor functions in the package but I have not checked)



          # download data : link dead
          #download.file("https://ucc93bf0aa50821e11b95c9530f5.dl.dropboxusercontent.com/zip_by_token_key?_download_id=9101556320431172280658295109635067362614982268430911643523348&_notify_domain=www.dropbox.com&dl=1&key=AV5mxk0trnetzASlH9_xJijTiGE55mUz0qa-x7JveZ7-Rdp3Z8i7GmwwQoWj8tUO14RKj51huhb5CuBdoxAC3WLuHvOMr7_bul691AmGpmwZgWWy0STezjFRnq0CVUR-iHNnZUHk9-t-i72nYODDpjXvo0PBhWTXwJuNWCSL4bnAauZREQtZwzNlspMF8PwZ37E9enf1WUUakLJwE43GbV2lAkuOTDghfcMmwokulIMEGA", destfile=temp<-tempfile())
          unzip(temp, exdir=xdir<-tempdir())

          nms <- list.files(xdir, pattern="xrdml", full.names=TRUE)
          # grab the names to names columns later
          cnms <- gsub(".*(LM \w+).*$", "\1", basename(nms))


          library(rxylib)

          # loop through files to read in
          lst <- lapply(nms, read_xyData, verbose = TRUE, metaData = FALSE)

          # grab the data
          dats <- lapply(lst, function(x) x$dataset[[1]]$data_block)

          # rename second column
          dats <- lapply(seq_along(dats), function(x) {
          colnames(dats[[x]])[2] <- cnms[x] ; dats[[x]]})

          # merge
          alldat <- Reduce(function(...) merge(..., by="2Theta"), dats)






          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Nov 20 '18 at 21:04

























          answered Nov 19 '18 at 18:07









          user20650user20650

          17k43367




          17k43367













          • Thanks for taking out time to help out with this... i added just a line of code to read in the file because the unzip failed path = "~/MEGA/R/Spectral_Files/Spectral_Files/Data" nms <- list.files(path, pattern="xrdml", full.names=TRUE) . Also the labelling doesn't work as expected because my files can different suffixes not only "LM". I tried modifying the gsub() but got error each time. It will be highly appreciated if you can help with this.

            – Hammao
            Nov 20 '18 at 20:40













          • you're welcome. re the names, you could try gsub(".*_(\w+ \w+).*$", "\1", basename(nms)) but I think it is better asking for help with this in a new question -- get the regrex folks eyes on it. (ps best to add a small sample of different potential names from basename(nms) to try and get all edge cases)

            – user20650
            Nov 20 '18 at 20:58








          • 1





            Thanks ... it worked for all file types, !!! I wish i have your type of knowledge in base r

            – Hammao
            Nov 20 '18 at 22:59



















          • Thanks for taking out time to help out with this... i added just a line of code to read in the file because the unzip failed path = "~/MEGA/R/Spectral_Files/Spectral_Files/Data" nms <- list.files(path, pattern="xrdml", full.names=TRUE) . Also the labelling doesn't work as expected because my files can different suffixes not only "LM". I tried modifying the gsub() but got error each time. It will be highly appreciated if you can help with this.

            – Hammao
            Nov 20 '18 at 20:40













          • you're welcome. re the names, you could try gsub(".*_(\w+ \w+).*$", "\1", basename(nms)) but I think it is better asking for help with this in a new question -- get the regrex folks eyes on it. (ps best to add a small sample of different potential names from basename(nms) to try and get all edge cases)

            – user20650
            Nov 20 '18 at 20:58








          • 1





            Thanks ... it worked for all file types, !!! I wish i have your type of knowledge in base r

            – Hammao
            Nov 20 '18 at 22:59

















          Thanks for taking out time to help out with this... i added just a line of code to read in the file because the unzip failed path = "~/MEGA/R/Spectral_Files/Spectral_Files/Data" nms <- list.files(path, pattern="xrdml", full.names=TRUE) . Also the labelling doesn't work as expected because my files can different suffixes not only "LM". I tried modifying the gsub() but got error each time. It will be highly appreciated if you can help with this.

          – Hammao
          Nov 20 '18 at 20:40







          Thanks for taking out time to help out with this... i added just a line of code to read in the file because the unzip failed path = "~/MEGA/R/Spectral_Files/Spectral_Files/Data" nms <- list.files(path, pattern="xrdml", full.names=TRUE) . Also the labelling doesn't work as expected because my files can different suffixes not only "LM". I tried modifying the gsub() but got error each time. It will be highly appreciated if you can help with this.

          – Hammao
          Nov 20 '18 at 20:40















          you're welcome. re the names, you could try gsub(".*_(\w+ \w+).*$", "\1", basename(nms)) but I think it is better asking for help with this in a new question -- get the regrex folks eyes on it. (ps best to add a small sample of different potential names from basename(nms) to try and get all edge cases)

          – user20650
          Nov 20 '18 at 20:58







          you're welcome. re the names, you could try gsub(".*_(\w+ \w+).*$", "\1", basename(nms)) but I think it is better asking for help with this in a new question -- get the regrex folks eyes on it. (ps best to add a small sample of different potential names from basename(nms) to try and get all edge cases)

          – user20650
          Nov 20 '18 at 20:58






          1




          1





          Thanks ... it worked for all file types, !!! I wish i have your type of knowledge in base r

          – Hammao
          Nov 20 '18 at 22:59





          Thanks ... it worked for all file types, !!! I wish i have your type of knowledge in base r

          – Hammao
          Nov 20 '18 at 22:59


















          draft saved

          draft discarded




















































          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.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f52134277%2fread-in-xrdml-data-within-a-complex-array%23new-answer', 'question_page');
          }
          );

          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







          Popular posts from this blog

          鏡平學校

          ꓛꓣだゔៀៅຸ໢ທຮ໕໒ ,ໂ'໥໓າ໼ឨឲ៵៭ៈゎゔit''䖳𥁄卿' ☨₤₨こゎもょの;ꜹꟚꞖꞵꟅꞛေၦေɯ,ɨɡ𛃵𛁹ޝ޳ޠ޾,ޤޒޯ޾𫝒𫠁သ𛅤チョ'サノބޘދ𛁐ᶿᶇᶀᶋᶠ㨑㽹⻮ꧬ꧹؍۩وَؠ㇕㇃㇪ ㇦㇋㇋ṜẰᵡᴠ 軌ᵕ搜۳ٰޗޮ޷ސޯ𫖾𫅀ल, ꙭ꙰ꚅꙁꚊꞻꝔ꟠Ꝭㄤﺟޱސꧨꧼ꧴ꧯꧽ꧲ꧯ'⽹⽭⾁⿞⼳⽋២៩ញណើꩯꩤ꩸ꩮᶻᶺᶧᶂ𫳲𫪭𬸄𫵰𬖩𬫣𬊉ၲ𛅬㕦䬺𫝌𫝼,,𫟖𫞽ហៅ஫㆔ాఆఅꙒꚞꙍ,Ꙟ꙱エ ,ポテ,フࢰࢯ𫟠𫞶 𫝤𫟠ﺕﹱﻜﻣ𪵕𪭸𪻆𪾩𫔷ġ,ŧآꞪ꟥,ꞔꝻ♚☹⛵𛀌ꬷꭞȄƁƪƬșƦǙǗdžƝǯǧⱦⱰꓕꓢႋ神 ဴ၀க௭எ௫ឫោ ' េㇷㇴㇼ神ㇸㇲㇽㇴㇼㇻㇸ'ㇸㇿㇸㇹㇰㆣꓚꓤ₡₧ ㄨㄟ㄂ㄖㄎ໗ツڒذ₶।ऩछएोञयूटक़कयँृी,冬'𛅢𛅥ㇱㇵㇶ𥄥𦒽𠣧𠊓𧢖𥞘𩔋цѰㄠſtʯʭɿʆʗʍʩɷɛ,əʏダヵㄐㄘR{gỚṖḺờṠṫảḙḭᴮᵏᴘᵀᵷᵕᴜᴏᵾq﮲ﲿﴽﭙ軌ﰬﶚﶧ﫲Ҝжюїкӈㇴffצּ﬘﭅﬈軌'ffistfflſtffतभफɳɰʊɲʎ𛁱𛁖𛁮𛀉 𛂯𛀞నఋŀŲ 𫟲𫠖𫞺ຆຆ ໹້໕໗ๆทԊꧢꧠ꧰ꓱ⿝⼑ŎḬẃẖỐẅ ,ờỰỈỗﮊDžȩꭏꭎꬻ꭮ꬿꭖꭥꭅ㇭神 ⾈ꓵꓑ⺄㄄ㄪㄙㄅㄇstA۵䞽ॶ𫞑𫝄㇉㇇゜軌𩜛𩳠Jﻺ‚Üမ႕ႌႊၐၸဓၞၞၡ៸wyvtᶎᶪᶹစဎ꣡꣰꣢꣤ٗ؋لㇳㇾㇻㇱ㆐㆔,,㆟Ⱶヤマފ޼ޝަݿݞݠݷݐ',ݘ,ݪݙݵ𬝉𬜁𫝨𫞘くせぉて¼óû×ó£…𛅑הㄙくԗԀ5606神45,神796'𪤻𫞧ꓐ㄁ㄘɥɺꓵꓲ3''7034׉ⱦⱠˆ“𫝋ȍ,ꩲ軌꩷ꩶꩧꩫఞ۔فڱێظペサ神ナᴦᵑ47 9238їﻂ䐊䔉㠸﬎ffiﬣ,לּᴷᴦᵛᵽ,ᴨᵤ ᵸᵥᴗᵈꚏꚉꚟ⻆rtǟƴ𬎎

          Why https connections are so slow when debugging (stepping over) in Java?