similar to: implicit loop for nested list

Displaying 20 results from an estimated 1100 matches similar to: "implicit loop for nested list"

2023 Jan 27
1
implicit loop for nested list
I would use replicate() to do an operation with random numbers repeatedly: ``` mysim <- replicate(10, { two.mat <- matrix(rnorm(4), 2, 2) four.mat <- matrix(rnorm(16), 4, 4) list(two.mat = two.mat, four.mat = four.mat) }) ``` which should give you a matrix-list. You can slice this matrix-list just like normal, then cbind it in one step: ``` two.mat <-
2025 Jan 28
2
R CMD check says no visible binding for global variable
Data.frame is returned by SQL query. It does have column names. In the function, I make small changes to some columns. Something like: Myquery <- ?SELECT date, price, stock FROM stocktab WHERE stock = ?ABC? AND date > ?2025-01-01?;? Prices <- dbGetQuery(con, myquery) SetDT(Prices) Prices[, date = as.Date(date)] R CMD check say ?no visible binding for global variable ?date?? Sent
2013 Feb 01
2
Nested loop and output help
Hello Everyone, My name is Thomas and I have been using R for one week. I recently found your site and have been able to search the archives of posts. This has given me some great information that has allowed me to craft an initial design to an inquiry I would like to make into the breakdown of McNemar's test. I have read an intro to R manual and the posting guides and hope I am not violating
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
Thanks everyone for their responses. My data is organized in a data.table.? My goal is to perform analyses according to some groups.? The results of analysis are objects.? If these objects could be stored as elements of a data.table, this would help downstream summarizing of results. Let me try another example. carsdt <- setDT(copy(mtcars)) carsdt[, unique(cyl) |> length()] #[1] 3
2025 Jan 28
2
R CMD check says no visible binding for global variable
That is an interesting fix Duncan suggested and it sounds now like everything WORKED as intended in data.table except that any checker being used externally is not able to del with things that look like a variable but are actually not a variable currently visible except within a function that is doing deferred evaluation. In this case, it recognizes the raw unevaluated string as being the name of
2025 Jan 28
1
R CMD check says no visible binding for global variable
This solution worked. Thanks Sent from my iPhone > On Jan 28, 2025, at 3:09?PM, Duncan Murdoch <murdoch.duncan at gmail.com> wrote: > > ?On 2025-01-28 1:55 p.m., Naresh Gurbuxani wrote: >> Data.frame is returned by SQL query. It does have column names. In the function, I make small changes to some columns. >> Something like: >> Myquery <- ?SELECT date,
2025 Jan 28
1
R CMD check says no visible binding for global variable
On 2025-01-28 1:55 p.m., Naresh Gurbuxani wrote: > Data.frame is returned by SQL query. It does have column names. In the function, I make small changes to some columns. > > Something like: > > Myquery <- ?SELECT date, price, stock FROM stocktab WHERE stock = ?ABC? AND date > ?2025-01-01?;? > > Prices <- dbGetQuery(con, myquery) > SetDT(Prices) > Prices[,
2025 Jan 28
1
R CMD check says no visible binding for global variable
There you go, once again helping strengthen ;) John Get Outlook for iOS<https://aka.ms/o0ukef> ________________________________ From: R-help <r-help-bounces at r-project.org> on behalf of avi.e.gross at gmail.com <avi.e.gross at gmail.com> Sent: Tuesday, January 28, 2025 12:01:25 AM To: 'Naresh Gurbuxani' <naresh_gurbuxani at hotmail.com>; r-help at r-project.org
2025 Jan 28
1
R CMD check says no visible binding for global variable
Naresh, I am not sure how you are creating your data.frame so it has no, I think, column names. There are two scenarios including one where it is not really a valid data.frame and one where it can be handled before any other use as shown below. If it cannot be used, you might need to modify how your SQL or the function you call creates it so it includes either names it chooses or that you supply.
2023 Nov 18
1
combine barchart and xyplot in lattice
On Sat, 18 Nov 2023 at 06:44, Naresh Gurbuxani <naresh_gurbuxani at hotmail.com> wrote: > > In below graph, I would like to add two vertical lines using > panel.abline(). Is this possible? I assume you want the 'v' variable in panel.abline() to be interpreted in the context of your x-axis, which here represents a factor variable. Unless two factor variables have the same
2025 Jan 14
1
Need help with time series
acf wants a time series, so tries to make one: as.ts(myts) Time Series: Start = 19357 End = 20027 Frequency = 1 [1] 24957 NA NA NA NA NA NA NA NA NA [11] NA NA NA NA NA NA NA NA NA NA [21] NA NA NA NA NA NA NA NA NA NA [31] NA 10577 NA NA NA NA NA
2024 Sep 22
1
store list objects in data.table
Well, you may have good reasons to do things this way -- and you certainly do not have to explain them here. But you might wish to consider using R's poly() function and a basic nested list structure to do something quite similar that seems much simpler to me, anyway: x <- rnorm(20) df <- data.frame(x = x, y = x + .1*x^2 + rnorm(20, sd = .2)) result <- with(df,
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,
2012 Jun 14
0
fixed trimmed mean for j-group
Hello...i want to find the empirical rate for type 1 error using fixed trimmed mean. To make it easy, i'm referring to journal given by this website http://www.academicjournals.org/ajmcsr/PDF/pdf2011/Yusof%20et%20al.pdf. I already run the programme and there is no error in it but i got zero for the empirical rate of type 1 error. The empirical rate for the type 1 error given in the journal
2012 Jul 07
0
fixed trimmed mean for group
Hello, I haven't found errors in your code. I implemented the test in the paper (the first, fixed symetric mean) and it also gives me zero Type I errors, when alpha = 0.05. Try to see the value of min(pv) or to plot the histogram of 'pv', hist(pv) and you'll see that there are no significant p-values, at that level. Anyway I'll continue to look at it, but my first
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[,
2025 Jan 14
1
Need help with time series
For below data, I find strange results in basic time series analysis. Why does acf() function find missing values? When crossprod(xmat) is invertible, why does arima() find system exactly singular? Thanks, Naresh x <- c(24957, 10577, -18516, 2940, -1458, 32704, -26697, -46902, 48413, -11937, 2043, 26431, -55336, -16838, 89651, 25363, -50388, -41012, -28242, -18213, 58759, -15290, -7413,
2013 Apr 24
2
Distance matrices Combinations
Dear UseRs, MY PROBLEM IS A SMALL PIECE OF A REAL BIG AND A COMPLICATED PROBLEM. IF I DELIBERATE IN A VERY SIMPLE WAY THEN ALL I WANT IS TO PUT ALL THE POSSIBLE COMBINATIONS OF 75 DISTANCE MATRICES (BY TAKING 4 MATRICES, MORE COMMONLY 75C4), in the following equation. t<-as.matrix((MAT1)^2+(MAT2)^2+(MAT3)^2+(MAT4)^2+,upper=T,diag=T)) Then "1215450" values of "t"(one for
2025 May 22
1
R session dies on lattice::show.settings()
I used Anaconda to install R on my Windows pc. From lattice package, show.settings() function causes R session to end. How can this problem be analysed? Sent from my iPhone ? > library(lattice) > sessionInfo() R version 4.1.3 (2022-03-10) Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows 10 x64 (build 22631) Matrix products: default locale: [1] LC_COLLATE=English_United