search for: h_gurbux

Displaying 7 results from an estimated 7 matches for "h_gurbux".

2024 Sep 28
1
lattice xyplot with cumsum() function inside
This code gives unexpected result. library(data.table) library(lattice) set.seed(123) mydt <- data.table(date = seq.Date(as.IDate("2024-01-01"), by = 1, length.out = 50), xgroup = "A", x = runif(50, 0, 1)) mydt <- rbindlist(list(mydt, data.table(date = mydt$date, xgroup = "B", x = runif(50, 0, 3)))) mydt[, `:=`(xcumsum = cumsum(x)), by = .(xgroup)] mydt[,
2024 Nov 05
0
lattice subscripts with both condition and group
How can I use subscripts to draw the last graph with one call to ? ? ? ? ? ? ? ? ? ? ? ?? function xyplot()? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? Thanks, ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? Naresh ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?
2023 Nov 18
1
combine barchart and xyplot in lattice
In below graph, I would like to add two vertical lines using panel.abline(). ?Is this possible? Thanks, Naresh mydf <- data.frame(hour = rep(6:20, 2), traffic = c(round(dnorm(6:20, 9, 3) * 10000), round(dnorm(6:20, 17, 4) * 10000)), direction = rep(c("inbound", "outbound"), c(15, 15))) vehicles <- data.frame(hour = 6:20, count = c(100, 120, 140, 125, 105, 80, 70, 75,
2023 Jan 27
3
implicit loop for nested list
> > I am looking for a more elegant way to write below code. > > #Simulation results have different dimensions > mysim <- lapply(1:10, function(y) { > two.mat <- matrix(rnorm(4), nrow = 2) > four.mat <- matrix(rnorm(16), nrow = 4) > list(two.mat = two.mat, four.mat = four.mat) #results with different dimensions > }) > > #Collect different
2024 May 09
2
Strange variable names in factor regression
On converting character variables to ordered factors, regression result has strange names. Is it possible to obtain same variable names with and without intercept? Thanks, Naresh mydf <- data.frame(date = seq.Date(as.Date("2024-01-01"), as.Date("2024-03-31"), by = 1)) mydf[, "wday"] <- weekdays(mydf$date, abbreviate = TRUE) mydf.work <- subset(mydf, !(wday
2024 Sep 21
3
store list objects in data.table
I am trying to store regression objects in a data.table df <- data.frame(x = rnorm(20)) df[, "y"] <- with(df, x + 0.1 * x^2 + 0.2 * rnorm(20)) mydt <- data.table(mypower = c(1, 2), myreg = list(lm(y ~ x, data = df), lm(y ~ x + I(x^2), data = df))) mydt #?? mypower??? myreg #???? <num>?? <list> #1:?????? 1 <lm[12]> #2:?????? 2 <lm[12]> But mydt[1, 2]
2024 Sep 22
2
store list objects in data.table
...olynomial > ## is the same as > result[[c(2,2)]] ## this is a bit easier for me to groc. > > Again, feel free to ignore without replying if my gratuitous remarks > are unhelpful. > > Cheers, > Bert > > > On Sat, Sep 21, 2024 at 2:25?PM Naresh Gurbuxani > <naresh_gurbuxani at hotmail.com> wrote: >> I am trying to store regression objects in a data.table >> >> df <- data.frame(x = rnorm(20)) >> df[, "y"] <- with(df, x + 0.1 * x^2 + 0.2 * rnorm(20)) >> >> mydt <- data.table(mypower = c(1, 2), myreg = list(lm(...