Re: [R] Basic astronomy package recommendation wanted.

2024-01-30 Thread Richard O'Keefe
Thank you for the tip about solrad. I don't need it right now, but I shall certainly have a use for it soon. On Wed, 31 Jan 2024 at 02:42, Kevin Thorpe wrote: > > There is also the package solrad that might do some of this. It is more > intended for calculating solar radiation, which is

Re: [R] Basic astronomy package recommendation wanted.

2024-01-30 Thread Richard O'Keefe
Thank you very much. suncalc looks like just what I want. On Tue, 30 Jan 2024 at 23:44, Enrico Schumann wrote: > > On Tue, 30 Jan 2024, Richard O'Keefe writes: > > > Given > > - UTC timestamp > > - a location (latitude,longitude,elevation) > > I want to know > > - the sun angles > > - the

Re: [R] R interpreting numeric field as a boolean field

2024-01-30 Thread Paul Bernal
Hi Bert, After doing sapply(your_dataframe, "class"), it seems like R is recognizing that the field is of type numeric after all, the problem (it seems) is how the import_list() function from the rio package is reading the data (my suspicion). Best regards, Paul El mar, 30 ene 2024 a las 14:59,

Re: [R] R interpreting numeric field as a boolean field

2024-01-30 Thread Paul Bernal
Hi Bert, Below the information you asked me for: nrow(mydataset) [1] 2986276 sapply(mydataset, "class") $`Transit Date` [1] "POSIXct" "POSIXt" $`Market Segment` [1] "character" $`Número de Tránsitos` [1] "numeric" $`Tar No` [1] "character" $`Beam Range (Operations)` [1]

Re: [R] R interpreting numeric field as a boolean field

2024-01-30 Thread CALUM POLWART
And your other option - recode what gets imported. It may well be you will actually want the blanks to be NAs for instance rather than blank. I'm assuming the True and False are >$0 and $0 from your description. (Or maybe vice versa). So I'd have made my column name something like

Re: [R] R interpreting numeric field as a boolean field

2024-01-30 Thread Duncan Murdoch
If you are using the read_excel() function from the readxl package, then there's an argument named col_types that lets you specify the types to use. You could specify col_types = "numeric" to read all columns as numeric columns. If some columns are different types, you should specify a

Re: [R] R interpreting numeric field as a boolean field

2024-01-30 Thread Bert Gunter
Incidentally, "didn't work" is not very useful information. Please tell us exactly what error message or apparently aberrant result you received. Also, what do you get from: sapply(your_dataframe, "class") nrow(your_dataframe) (as I suspect what you think it is, isn't). Cheers, Bert On Tue,

Re: [R] R interpreting numeric field as a boolean field

2024-01-30 Thread Paul Bernal
Dear friend Duncan, Thank you so much for your kind reply. Yes, that is exactly what is happening, there are a lot of NA values at the start, so R assumes that the field is of type boolean. The challenge that I am facing is that I want to read into R an Excel file that has many sheets (46 in this

Re: [R] R interpreting numeric field as a boolean field

2024-01-30 Thread Duncan Murdoch
On 30/01/2024 11:10 a.m., Paul Bernal wrote: Dear friends, Hope you are doing well. I am currently using R version 4.3.2, and I have a .xlsx file that has 46 sheets on it. I basically combined all 46 sheets and read them as a single dataframe in R using package rio. I read a solution using

[R] R interpreting numeric field as a boolean field

2024-01-30 Thread Paul Bernal
Dear friends, Hope you are doing well. I am currently using R version 4.3.2, and I have a .xlsx file that has 46 sheets on it. I basically combined all 46 sheets and read them as a single dataframe in R using package rio. I read a solution using package readlx, as suggested in a StackOverflow

Re: [R] Use of geometric mean for geochemical concentrations

2024-01-30 Thread Rich Shepard
On Tue, 30 Jan 2024, Leo Mada wrote: It depends how the data is generated. Although I am not an expert in ecology, I can explain it based on a biomedical example. Leo, My data are environmental, observational concentrations of water constituents. It's not only how data are generated, what

Re: [R] Use of geometric mean for geochemical concentrations

2024-01-30 Thread Leo Mada via R-help
Dear Rich, It depends how the data is generated. Although I am not an expert in ecology, I can explain it based on a biomedical example. Certain variables are generated geometrically (exponentially), e.g. MIC or Titer. MIC = Minimum Inhibitory Concentration for bacterial resistance Titer =

Re: [R] Basic astronomy package recommendation wanted.

2024-01-30 Thread Kevin Thorpe
There is also the package solrad that might do some of this. It is more intended for calculating solar radiation, which is probably not what you want, but may do other things you may find helpful. > On Jan 30, 2024, at 5:44 AM, Enrico Schumann wrote: > > On Tue, 30 Jan 2024, Richard O'Keefe

Re: [R] linear programming in R | limits to what it can do, or my mistake?

2024-01-30 Thread Jinsong Zhao
On 2024/1/30 20:00, Martin Becker wrote: Apart from the fact that the statement "such that t1+t2+t3+t4=2970 (as it must)" is not correct, the LP can be implemented as follows: I was confused by "such that t1+t2+t3+t4=2970 (as it must)", otherwise, I also get the same solution.

Re: [R] linear programming in R | limits to what it can do, or my mistake?

2024-01-30 Thread Martin Becker
Apart from the fact that the statement "such that t1+t2+t3+t4=2970 (as it must)" is not correct, the LP can be implemented as follows: library(lpSolve) LHS <- rbind( c(0,0,0,0, 1, 0, 0,0), c(1,0,0,0,-1, 1, 0,0), c(0,1,0,0, 0,-1, 1,0), c(0,0,1,0, 0, 0,-1,1), cbind(-diag(4),diag(4)),

Re: [R] Basic astronomy package recommendation wanted.

2024-01-30 Thread Enrico Schumann
On Tue, 30 Jan 2024, Richard O'Keefe writes: > Given > - UTC timestamp > - a location (latitude,longitude,elevation) > I want to know > - the sun angles > - the moon angles > - the phase of the moon. > I looked on CRAN for astronomy, but didn't notice anything that seems > to offer what I

[R] Basic astronomy package recommendation wanted.

2024-01-30 Thread Richard O'Keefe
Given - UTC timestamp - a location (latitude,longitude,elevation) I want to know - the sun angles - the moon angles - the phase of the moon. I looked on CRAN for astronomy, but didn't notice anything that seems to offer what I want. I could try coding these functions myself, but "if you

[R] linear programming in R | limits to what it can do, or my mistake?

2024-01-30 Thread Evan Cooch
Question for 'experts' in LP using R (using the lpSolve package, say) -- which does not apply to me for the sort of problem I describe below. I've run any number of LP's using lpSolve in R, but all of them to date have objective and constraint functions that both contain the same variables.