Re: [R] extract parts of a list before symbol

2023-05-25 Thread avi.e.gross
All true Jeff, but why do things the easy way! LOL! My point was that various data structures, besides the list we started with, store the names as an attribute. Yes, names(listname) works fine to extract whatever parts they want. My original idea of using a data.frame was because it creates

Re: [R] extract parts of a list before symbol

2023-05-25 Thread Jeff Newmiller
What a remarkable set of detours, Avi, all deriving apparently from a few gaps in your understanding of R. As Rolf said, "names(test)" is the answer. a) Lists are vectors. They are not atomic vectors, but they are vectors, so as.vector(test) is a no-op. test <- list( a = 1, b = 2, c=3 )

Re: [R] extract parts of a list before symbol

2023-05-25 Thread avi.e.gross
Evan, List names are less easy than data.frame column names so try this: > test <- list(a=3,b=5,c=11) > colnames(test) NULL > colnames(as.data.frame(test)) [1] "a" "b" "c" But note an entry with no name has one made up for it. > test2 <- list(a=3,b=5, 666, c=11) > colnames(data.frame(test2))

Re: [R] extract parts of a list before symbol

2023-05-25 Thread Rolf Turner
On Thu, 25 May 2023 13:29:52 -0400 Evan Cooch wrote: > Suppose I have the following list: > > test <- list(a=3,b=5,c=11) > > I'm trying to figure out how to extract the characters to the left of > the equal sign (i.e., I want to extract a list of the variable names, > a, b and c. > > I've

[ESS] brms / cmdstanr crashes in emacs but not terminal

2023-05-25 Thread Joshua Wiley via ESS-help
Hi All, I normally work in Emacs (28.2 build 2)) on Windows 11 pro as an admin user. Quite a few of my analyses these days use Stan (via cmdstanr and the brms package as example). I upgraded R to 4.3.0 and Stan. Now, I am quite reliably getting crashes where my R process terminates when using

Re: [R] environments: functions within functions

2023-05-25 Thread Sarah Goslee
Thank you to both Duncan and Ivan for the detailed answers. I'll point the mixR maintainer at this thread in the list archive, because your suggestions were so clear, and I can't explain them as thoroughly. I'll keep using x as the argument name for now. Much appreciated, Sarah On Thu, May 25,

[R] extract parts of a list before symbol

2023-05-25 Thread Evan Cooch
Suppose I have the following list: test <- list(a=3,b=5,c=11) I'm trying to figure out how to extract the characters to the left of the equal sign (i.e., I want to extract a list of the variable names, a, b and c. I've tried the permutations I know of involving sub - things like

Re: [R] data.frame with a column containing an array

2023-05-25 Thread Jeff Newmiller
Maybe... if you want it to act like a matrix... then you should... use a matrix... I think making this behaviour work with 2d arrays could be a feature, but making it work with higher dimension arrays would be difficult, and differentiating between 2d and higher dimension arrays could have

Re: [R] data.frame with a column containing an array

2023-05-25 Thread Bert Gunter
I really don't know. I would call it a request for extended capabilities of [.data.frame, rather than a feature or bug. But maybe wiser heads than mine who monitor this list can sort it out. -- Bert On Wed, May 24, 2023 at 8:52 PM Georg Kindermann wrote: > So is this an expected behavior or is

Re: [R] environments: functions within functions

2023-05-25 Thread Ivan Krylov
(Sorry for the double post.) В Thu, 25 May 2023 18:53:45 +0300 Ivan Krylov пишет: > print(fit1) # tracer not called Interesting. There must be some caching involved. If print(a) is resolved to print.mixfitEM at least once, it keeps failing. In a fresh R session, where a trace()-patch is done

Re: [R] environments: functions within functions

2023-05-25 Thread Ivan Krylov
В Thu, 25 May 2023 10:18:13 -0400 Sarah Goslee пишет: > print called on this object gets passed to print.mixfitEM(), which is: > > > function (x, digits = getOption("digits"), ...) > { > family <- x$family > mc <- match.call() > mc$digits <- digits > fun.name <- paste0("print",

Re: [R] environments: functions within functions

2023-05-25 Thread Duncan Murdoch
On 25/05/2023 10:18 a.m., Sarah Goslee wrote: Hi, I ran into a problem with S3 method dispatch and scoping while trying to use functions from the mixR package within my own functions. I know enough to find the problem (I think!), but not enough to fix it myself. The problem isn't really a

[R] environments: functions within functions

2023-05-25 Thread Sarah Goslee
Hi, I ran into a problem with S3 method dispatch and scoping while trying to use functions from the mixR package within my own functions. I know enough to find the problem (I think!), but not enough to fix it myself. The problem isn't really a package-specific problem, so I'm starting here, and

[R] [Rd] R 4.3.1 scheduled for June 16

2023-05-25 Thread Peter Dalgaard via R-help
Full schedule available on developer.r-project.org in a short while. -- Peter Dalgaard, Professor, Center for Statistics, Copenhagen Business School Solbjerg Plads 3, 2000 Frederiksberg, Denmark Phone: (+45)38153501 Office: A 4.23 Email: pd@cbs.dk Priv: pda...@gmail.com

Re: [R] data.frame with a column containing an array

2023-05-25 Thread Georg Kindermann
So is this an expected behavior or is it a bug which should be reported somewhere else? Thanks! Georg      Gesendet: Dienstag, 09. Mai 2023 um 19:28 Uhr Von: "Bert Gunter" An: "Georg Kindermann" Cc: "Rui Barradas" , r-help@r-project.org Betreff: Re: [R] data.frame with a column containing an