Displaying 20 results from an estimated 7000 matches similar to: "Convert character date time to R date-time variable."
2023 Dec 07
1
Convert character date time to R date-time variable.
?s 16:21 de 07/12/2023, Sorkin, John escreveu:
> Colleagues,
>
> I have a matrix of character data that represents date and time. The format of each element of the matrix is
> "2020-09-17_00:00:00"
> How can I convert the elements into a valid R date-time constant?
>
> Thank you,
> John
>
>
>
> John David Sorkin M.D., Ph.D.
> Professor of
2024 Jun 08
3
Can't compute row means of two columns of a dataframe.
I have a data frame with three columns, TotalInches, Low20, High20. For each row of the dataset, I am trying to compute the mean of Low20 and High20.
xxxz <- structure(list(TotalInches =
c(58, 59, 60, 61, 62, 63, 64, 65,
66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76), Low20 = c(84, 87,
90, 93, 96, 99, 102, 106, 109, 112, 116, 119, 122,
2024 May 09
2
Print date on y axis with month, day, and year
I am trying to use ggplot to plot the data, and R code, below. The dates (jdate) are printing as Mar 01, Mar 15, etc. I want to have the date printed as MMM DD YYYY (or any other way that will show month, date, and year, e.g. mm/dd/yy). How can I accomplish this?
yyy <- structure(list(
jdate = structure(c(19052, 19053, 19054, 19055,
19058, 19059, 19060, 19061, 19062,
2023 Dec 07
1
Convert character date time to R date-time variable.
Look at the lubridate package in R.
Regards,
Tim
-----Original Message-----
From: R-help <r-help-bounces at r-project.org> On Behalf Of Sorkin, John
Sent: Thursday, December 7, 2023 11:22 AM
To: r-help at r-project.org (r-help at r-project.org) <r-help at r-project.org>
Subject: [R] Convert character date time to R date-time variable.
[External Email]
Colleagues,
I have a matrix of
2023 Dec 08
1
Convert character date time to R date-time variable.
On 12/7/23 08:21, Sorkin, John wrote:
> Colleagues,
>
> I have a matrix of character data that represents date and time. The format of each element of the matrix is
> "2020-09-17_00:00:00"
> How can I convert the elements into a valid R date-time constant?
You will not be able to store these datetime values in an R matrix, at
least as class POSIXct. You could with class
2024 Jan 04
1
Obtaining a value of pie in a zero inflated model (fm-zinb2)
I am running a zero inflated regression using the zeroinfl function similar to the model below:
fm_zinb2 <- zeroinfl(art ~ . | ., data = bioChemists, dist = "poisson")
summary(fm_zinb2)
I have three questions:
1) How can I obtain a value for the parameter pie, which is the fraction of the population that is in the zero inflated model vs the fraction in the count model?
2) For
2023 Dec 08
1
Convert two-dimensional array into a three-dimensional array.
Colleagues
I want to convert a 10x2 array:
# create a 10x2 matrix.
datavals <- matrix(nrow=10,ncol=2)
datavals[,] <- rep(c(1,2),10)+c(rnorm(10),rnorm(10))
datavals
into a 10x3 array, ThreeDArray, dim(10,2,10).
The values storede in ThreeDArray's first dimensions will be the data stored in datavalues.
ThreeDArray[i,,] <- datavals[i,]
The values storede in ThreeDArray's second
2024 Jun 08
1
Can't compute row means of two columns of a dataframe.
Use apply(), not by().
xxxz$av20 <- apply(xxxz[,c("Low20","High20")],1, mean)
-- Bert
On Sat, Jun 8, 2024 at 10:38?AM Sorkin, John <jsorkin at som.umaryland.edu>
wrote:
> I have a data frame with three columns, TotalInches, Low20, High20. For
> each row of the dataset, I am trying to compute the mean of Low20 and
> High20.
>
> xxxz <-
2024 Jan 04
1
Obtaining a value of pie in a zero inflated model (fm-zinb2)
Are you referring to the zeroinfl() function in the countreg package? If
so, I think
predict(fm_zinb2, type = "zero", newdata = some.new.data)
will give you pi for each combination of covariate values that you
provide in some.new.data
where pi is the probability to observe a zero from the point mass component.
As to your second question, I'm not sure that's possible, for any
2024 Jun 08
1
Can't compute row means of two columns of a dataframe.
John,
Maybe you can clarify what you want the output to look like. It took me a
while to realize what you may want as it is NOT properly described as
wanting rowsums.
There is a standard function called rowMeans() that probably does what you
want if you want the mean of all rows as in:
> rowMeans(xxxz)
[1] 84.33333 87.00000 89.66667 92.33333 95.00000 97.66667 100.33333
103.66667
2024 Apr 07
1
Question regarding reservoir volume and water level
Aside from the fact that the original question might well be a class exercise (or homework), the question is unanswerable given the data given by the original poster. One needs to know the dimensions of the reservoir, above and below the current waterline. Are the sides, above and below the waterline smooth? Is the region currently above the waterline that can store water a mirror image of the
2024 Feb 24
1
Rtools and things dependent on it
David,
I greatly appreciate the explanation you gave regarding R tools providing tools available in Linux distros, but not found in Windows. (I am using a windows system). Does this mean that Linux users don't need to use R tools when they want to compile R code?
Additionally, thank you for the information about what I should read. I will look at the material again, and hopefully things the
2024 Apr 07
1
Question regarding reservoir volume and water level
?s 13:27 de 07/04/2024, javad bayat escreveu:
> Dear all;
> I have a question about the water level of a reservoir, when the volume
> changed or doubled.
> There is a DEM file with the highest elevation 1267 m. The lowest elevation
> is 1230 m. The current volume of the reservoir is 7,000,000 m3 at 1240 m.
> Now I want to know what would be the water level if the volume rises to
2024 Apr 07
1
Question regarding reservoir volume and water level
John,
Your reaction was what my original reaction was until I realized I had to
find out what a DEM file was and that contains enough of the kind of
depth-dimension data you describe albeit what may be a very irregular cross
section to calculate for areas and thence volumes.
If I read it correctly, this can be a very real-world problem worthy of a
solution, such as in places like California
2024 Feb 24
1
Rtools and things dependent on it
On 2/23/24 16:28, Sorkin, John wrote:
> David,
> My apologies regarding the format of my email. I am replying using my
> iPhone, and I can?t find a way to switch from what I suspect is html
> to txt format.
> The link you sent told me that R tools allows compilation of code.
It's specifically designed to provide the code tools missing in Windows
that would other wise have
2024 Aug 22
2
Linear regression and stand deviation at the Linux command line
R List,
Please excuse this ultra-newbie post.
I looked at this page but it's a bit beyond me.
https://www2.kenyon.edu/Depts/Math/hartlaub/Math305%20Fall2011/R.htm
I'm interested in R construct(s) to be entered at the command
line that would output slope, y-intercept, and r-squared values read
from a csv or other filename entered at the command line, and the same
for standard deviation
2024 Sep 28
2
Is there a sexy way ...?
"Sexy code" may get a job done and demonstrate the code's knowledge of a programming language, but it often does this at the expense of clear, easy to document (i.e. annotate what the code does), easy to read, and easy to understand code. I fear that this is what this thread has developed "sexy" but not easily understandable code. While I send kudos to all of you, remember
2006 Dec 09
7
Simulation with R
An apparatus exists whereby a collection of balls is displaced to the
top of a stack by suction. A top level (Level 1) each ball is shifted
1 unit to the left or 1 unit to the right at random with equal
probability. The ball then drops down to level 2. At Level 2, each
ball is again shifted 1 unit to the left or 1 unit to the right at
random. The process continues for 15 levels and the balls are
2005 Jul 28
4
CSV file and date. Dates are read as factors!
I am using read.csv to read a CSV file (produced by saving an Excel file
as a CSV file). The columns containing dates are being read as factors.
Because of this, I can not compute follow-up time, i.e.
Followup<-postDate-preDate. I would appreciate any suggestion that would
help me read the dates as dates and thus allow me to calculate follow-up
time.
Thanks
John
John Sorkin M.D., Ph.D.
Chief,
2005 Jul 15
3
Dividing a vector into ntiles
R 2.1.1
Win 2k
Would someone suggest a method (or methods) that can be used to
determine ntile cutpoints of a vector, i.e. to determine values that can
be used to divide a vector into thirds such as 0-33 centile, 34-66
centile, 67-100 centile. If for example I had a vector:
1,2,3,4,5,6,7,8,9
and wanted to divide the vector into thirds
I would have cut-points of 3, and 6.
Thanks,
John
John