Robert Knight
2020-Sep-08 03:51 UTC
[R] Some R code works on Linux, but not Linux via Windows Subsystem Linux
RE: Some R code works on Linux, but not Linux via Windows Subsystem Linux This is taking data from a CSV and placing it into a data frame. This is R 3.6.3 inside Windows Subsystem for Linux v2, Ubuntu 18.04. The exact same code, unchanged and on the same computer, works correctly in Ubuntu 18.04 and other Linux systems directly if the computer is dual booted into one of those rather than Windows. Error in FUN(X[[i]], ?) : only defined on a data frame with all numeric variables Calls: Summary.data.frame -> lapply -> FUN Any idea why the FUN function would error on Windows Subsytem for Linux, but not Linux itself? Any insight into the basic mechanism of how that could vary between systems? Haven't yet checked to see if the data is even getting imported via WSL. The script runs using Rscript as opposed to running interactively via the R console. Robert D. Knight, MBA Developer of Meal Plan and Grocery List maker for Android and iOS. https://play.google.com/store/apps/details?id=io.robertknight.MPGL https://itunes.apple.com/us/app/meal-plan-and-grocery-list/id1452755707 [[alternative HTML version deleted]]
Eric Berger
2020-Sep-08 10:56 UTC
[R] Some R code works on Linux, but not Linux via Windows Subsystem Linux
Hi Robert, You don't provide a self-contained reproducible example, so I am just guessing here. I doubt your theory that the error is related to R. More likely the step that creates a data frame from reading the CSV is probably resulting in different data frames in the two cases. I recommend that you compare the data frames. (And, if they differ, it might be related to filenames, directory structures, assumptions about these, etc.) Another possibility is that you have R 4.* somewhere and there is, in fact, a difference between R 3.* and R4.* in terms of creating a data frame from a CSV file. If my "guesses" are not correct, see if you can create a self-contained reproducible example (that does not depend on reading in the CSV. You can just provide the contents of the data frame via dput().) Then post the example to the list. HTH, Eric On Tue, Sep 8, 2020 at 1:47 PM Robert Knight <bobby.knight at gmail.com> wrote:> RE: Some R code works on Linux, but not Linux via Windows Subsystem Linux > > This is taking data from a CSV and placing it into a data frame. This is R > 3.6.3 inside Windows Subsystem for Linux v2, Ubuntu 18.04. The exact same > code, unchanged and on the same computer, works correctly in Ubuntu 18.04 > and other Linux systems directly if the computer is dual booted into one of > those rather than Windows. > > Error in FUN(X[[i]], ?) : > only defined on a data frame with all numeric variables > Calls: Summary.data.frame -> lapply -> FUN > > Any idea why the FUN function would error on Windows Subsytem for Linux, > but not Linux itself? Any insight into the basic mechanism of how that > could vary between systems? Haven't yet checked to see if the data is even > getting imported via WSL. The script runs using Rscript as opposed to > running interactively via the R console. > > Robert D. Knight, MBA > > Developer of Meal Plan and Grocery List maker for Android and iOS. > https://play.google.com/store/apps/details?id=io.robertknight.MPGL > https://itunes.apple.com/us/app/meal-plan-and-grocery-list/id1452755707 > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. >[[alternative HTML version deleted]]
Tomas Kalibera
2020-Sep-08 11:01 UTC
[R] Some R code works on Linux, but not Linux via Windows Subsystem Linux
On 9/8/20 5:51 AM, Robert Knight wrote:> RE: Some R code works on Linux, but not Linux via Windows Subsystem Linux > > This is taking data from a CSV and placing it into a data frame. This is R > 3.6.3 inside Windows Subsystem for Linux v2, Ubuntu 18.04. The exact same > code, unchanged and on the same computer, works correctly in Ubuntu 18.04 > and other Linux systems directly if the computer is dual booted into one of > those rather than Windows. > > Error in FUN(X[[i]], ?) : > only defined on a data frame with all numeric variables > Calls: Summary.data.frame -> lapply -> FUN > > Any idea why the FUN function would error on Windows Subsytem for Linux, > but not Linux itself? Any insight into the basic mechanism of how that > could vary between systems? Haven't yet checked to see if the data is even > getting imported via WSL. The script runs using Rscript as opposed to > running interactively via the R console.Yes, I think you should just try importing the data (reading the CSV), this is probably where things break. Then try also with a small trivial variant of that CSV, ensuring it only has ASCII characters, as a sanity check. So in other words, creating a minimal reproducible example. This can be an encoding issue, for instance. Tomas> > Robert D. Knight, MBA > > Developer of Meal Plan and Grocery List maker for Android and iOS. > https://play.google.com/store/apps/details?id=io.robertknight.MPGL > https://itunes.apple.com/us/app/meal-plan-and-grocery-list/id1452755707 > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code.