nielshintzen / vmstools

Automatically exported from code.google.com/p/vmstools
18 stars 12 forks source link

Issue wih column headings: Interpolation2Tacsat #11

Closed s-y-r closed 3 years ago

s-y-r commented 8 years ago

Hi,

I am having an issue with the interpolation2Tacsat function. I receive the following message:

Error in[.data.frame(x, , clnames) : undefined columns selected

I have looked at the source code of the function and the issue is with this section of code:

ret<-lapply(ret,function(x) {x[,clname]})

It seems that the list object (ret) doesn't have matching columns for each list element. For instance, some of the list elements are missing the FT_REF or SI_STATE column. I have managed to get around the error by removing columns from my tacsat including SI_STATE and FT _REF - however this is not ideal since I would like those columns to remain in my interpolated dataset.

The other fix that I found was to add "FT_REF" to source code that creates the object B

b <- lapply(intidx, function(x) {
   cls <- clnames[tacsat[x[1], ] %in% tacsat[x[2], ]]
   return(cls[!cls %in% c("SI_LONG", "SI_LATI", "SI_HE", 
   "SI_SP", "SI_DATE", "SI_TIME", "SI_DATIM", "FT_REF")])
   })

I can't understand why the code is pulling out FT_REFs for some list elements and not others - there are no NAs in my data.

Any help would be much appreciated.

Sally

nielshintzen commented 8 years ago

Hi Sally,

It is quite difficult to see from your message what really is going wrong. Could you use the tacsat and eflalo example datasets in VMStools to recreate your problem (trying to make the format of that example data similar to your data) and send a short script, then I can have a look into it.

Linking SI_STATE and FT_REF back to the tacsat format should be relatively easy, so I’m not too worried about that right now.

Where is the code pulling out FT_REF? It is in your fix but not in the original script. The whole idea is that the columns that are pulled out need to be interpolated as well, and FT_REF is not part of that.

Kind regards,

Niels

From: s-y-r [mailto:notifications@github.com] Sent: donderdag 18 augustus 2016 12:35 To: nielshintzen/vmstools Subject: [nielshintzen/vmstools] Issue wih column headings: Interpolation2Tacsat (#11)

Hi,

I am having an issue with the interpolation2Tacsat function. I receive the following message:

Error in[.data.frame(x, , clnames) : undefined columns selected

I have looked at the source code of the function and the issue is with this section of code:

ret<-lapply(ret,function(x) {x[,clname]})

It seems that the list object (ret) doesn't have matching columns for each list element. For instance, some of the list elements are missing the FT_REF or SI_STATE column. I have managed to get around the error by removing columns from my tacsat including SI_STATE and FT _REF - however this is not ideal since I would like those columns to remain in my interpolated dataset.

The other fix that I found was to add "FT_REF" to source code that creates the object B

b <- lapply(intidx, function(x) {

cls <- clnames[tacsat[x[1], ] %in% tacsat[x[2], ]]

return(cls[!cls %in% c("SI_LONG", "SI_LATI", "SI_HE",

"SI_SP", "SI_DATE", "SI_TIME", "SI_DATIM", "FT_REF")])

})

I can't understand why the code is pulling out FT_REFs for some list elements and not others - there are no NAs in my data.

Any help would be much appreciated.

Sally

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://github.com/nielshintzen/vmstools/issues/11, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AEwaJGwhNMvFmFikx-L8S1BdNfAQq3w8ks5qhDU6gaJpZM4JnWxR.

nielshintzen commented 3 years ago

Bug fixes of this routine have been processed in latest version of VMStools