similar to: update numeric values of list with new values...

Displaying 20 results from an estimated 50000 matches similar to: "update numeric values of list with new values..."

2017 Sep 22
0
update numeric values of list with new values...
Solved it: test <- list(a=1,b=2,c=3) new <- c(4,5,6) hold <- as.list(new) updated_test <- replace(test,c(1:3),hold) $a [1] 4 $b [1] 5 $c [1] 6 mean.parms <- as.list(mean.parms) mm.parms <- replace(far.parms,c(1:length(far.parms)),mean.parms) On 9/22/2017 10:34 AM, Evan Cooch wrote: > Suppose I have the following: > > test <- list(a=1,b=2,c=3) > > I
2017 Sep 22
1
update numeric values of list with new values...
Well, that's a bit like driving from Boston to New York by way of Chicago. See ?structure test <- list(a=1,b=2,c=3) new <- c(4,5,6) test.new <- structure(as.list(new), names=names(test)) test.new $a [1] 4 $b [1] 5 $c [1] 6 Cheers, Bert Bert Gunter "The trouble with having an open mind is that people keep coming along and sticking things into it." -- Opus (aka
2024 Feb 27
4
converting MATLAB -> R | element-wise operation
So, trying to convert a very long, somewhat technical bit of lin alg MATLAB code to R. Most of it working, but raninto a stumbling block that is probaably simple enough for someone to explain. Basically, trying to 'line up' MATLAB results from an element-wise division of a matrix by a vector with R output. Here is a simplified version of the MATLAB code I'm translating: NN = [1,
2020 Oct 12
1
Problems with large loops in CentOS
Hi I?aki and Evan, Thank you for checking this. My version of CentOS was installed by the Federal Government, and there is disk encryption. I am able to regularly update CentOS. Anyway, the problem seems to be on my end. For me, the code just hangs... my R scripts never run if they are too long. So, I created that script, which fails on my computer. I have a personal computer with Ubuntu,
2017 Jun 21
4
selecting dataframe columns based on substring of col name(s)
Suppose I have the following sort of dataframe, where each column name has a common structure: prefix, followed by a number (for this example, col1, col2, col3 and col4): d = data.frame( col1=runif(10), col2=runif(10), col3=runif(10),col4=runif(10)) What I haven't been able to suss out is how to efficiently 'extract/manipulate/play with' columns from the data frame, making use
2020 Oct 31
3
R 4.0 for CentOS 7
Please, see spot's comment in the BZ I linked in my previous comment. The thing is not that it can't be done (you could install a newer devtoolset, v8 or v9, build R and use it), the thing is that it cannot be distributed in EPEL, because we're allowed to build against a devtoolset, but not depend on it, so the distribution would be broken (you could not install packages unless you
2023 May 25
3
extract parts of a list before symbol
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 sub("\\=.*", "", test), but no matter what I try, sub keeps returning (3, 5, 11).
2006 Apr 01
4
-newbie | RODBC import query
Greetings - After 20+ years of using SAS, for a variety of reasons, I'm using [R] for a bunch of things - while I'm getting a pretty good a handling [R] for script programming, and statistical analysis, I'm struggling with 'pulling data into [R]'. For reasons beyond my control, a number of the files I get sent to 'work with' are in Dbase format (*.dbf). For
2017 Sep 28
2
building random matrices from vectors of random parameters
Sure -- thanks -- only took me 3-4 attempts to get aperm to work (as opposed to really thinking hard about how it works ;-) On 9/28/2017 11:55 AM, Duncan Murdoch wrote: > On 28/09/2017 9:10 AM, Evan Cooch wrote: >> Thanks for both the mapply and array approaches! However, although >> intended to generate the same result, they don't: >> >> # mapply approach
2006 Sep 18
1
symbolic matrix elements...
Normally, I do symbolics in Maple, or Mathematica, but I'm trying to write a simple script for students to handle some *very* simple calculations (for other purposes) with matrix or vector elements, where the elements are coded symbolically. What I've tried with *partial" success is use of the tilde (~) operator. So, for example, consider a simple vector: test=matrix(c(~
2018 May 25
1
options other than regex
Numbers -- thanks. Another clever trick. On 5/25/2018 11:54 AM, Greg Minshall wrote: > Evan, > > are you really looking at numbers, or just at character strings (that, > in your case, happen to be numbers)? if just characters, this rather > odd combination of strsplit() and Reduce() might do the trick: > ---- >> x <- '10110111' >> print(x) > [1]
2024 Feb 27
2
[External] converting MATLAB -> R | element-wise operation
> t(t(NN)/lambda) [,1] [,2] [,3] [1,] 0.5 0.6666667 0.75 [2,] 2.0 1.6666667 1.50 > R matrices are column-based. MATLAB matrices are row-based. > On Feb 27, 2024, at 14:54, Evan Cooch <evan.cooch at gmail.com> wrote: > > So, trying to convert a very long, somewhat technical bit of lin alg > MATLAB code to R. Most of it working, but raninto a stumbling block
2016 Jun 06
2
problems compiling packages | 3.3.0 | Linux
Thanks very much. I had more or less reached the same conclusions -- I was just about to rebuild RPMs for source for zlib, etc, and update those, and try again, but I've had mixed success in doing that in past. Its easy enough to roll back to 3.2.5 (which compiles perfectly against all the CentOS 6.x.x libs), but 3.30 plays nice with a few other things I work with. Hence my interest in
2017 Sep 28
3
building random matrices from vectors of random parameters
Suppose I have interest in a matrix with the following symbolic structure (specified by 3 parameters: sa, so, m): matrix(c(0,sa*m,so,sa),2,2,byrow=T) What I can't figure out is how to construct a series of matrices, where the elements/parameters are rnorm values. I'd like to construct separate matrices, with each matrix in the series using the 'next random parameter value'.
2017 Jun 21
0
selecting dataframe columns based on substring of col name(s)
> On Jun 21, 2017, at 9:11 AM, Evan Cooch <evan.cooch at gmail.com> wrote: > > Suppose I have the following sort of dataframe, where each column name has a common structure: prefix, followed by a number (for this example, col1, col2, col3 and col4): > > d = data.frame( col1=runif(10), col2=runif(10), col3=runif(10),col4=runif(10)) > > What I haven't been able to
2009 Dec 17
2
Problem with spliting a dataframe values
Hi all, Hi this is kiran I am facing a problem to split a dataframe that is.. i have a string like: "a,b,c|1,2,3|4,5,6|7,8,8" first I have to split with respect to "|" I did it with command unlist(strsplit("a,b,c|1,2,3|4,5,6|7,8,8", "\\,")) after getting that set i made it as a dataframe and it comes like a,b,c 1,2,3 4,5,6 7,8,8 now i have to
2020 Oct 31
2
R 4.0 for CentOS 7
On 10/30/2020 05:02 AM, I?aki Ucar wrote: > Please, do not crosspost. As I said in the Bugzilla issue, R cannot be > further updated in EPEL-7, see > https://bugzilla.redhat.com/show_bug.cgi?id=1871685#c2. > > I?aki > > > On Fri, 30 Oct 2020 at 02:30, H <agents at meddatainc.com> wrote: >> I am running R 4.6 under CentOS 7 but would like to upgrade. Just found
2018 May 25
4
options other than regex
Hi -- I'm looking for alternatives to regex for a fairly simply 'reformatting' problem. Alternatives only because a lot of folks have trouble parsing/interpreting regex expressions, and I'm looking for suggestions for something more 'transparent'. Here is an example of what I'm trying to do. Take the following string, which I call x, and for each character in the
2024 Feb 27
2
converting MATLAB -> R | element-wise operation
Why anything but sweep? The fundamental data type in Matlab is a matrix... they don't have vectors, they have Nx1 matrices and 1xM matrices. Vectors don't have any concept of "row" vs. "column". Straight division is always elementwise with recycling as needed, and matrices are really vectors in row-major order: 1 2 3 4 5 6 is really 1 4 2 5 3 6 and when you do
2016 Jun 04
2
problems compiling packages | 3.3.0 | Linux
Updated my R install on my GNU/Linux boxes (running CentOS 6.8) from 3.2.x -> 3.3.0, using latest from epel (i.e., not compiling from source), and while said upgrade seemed to go fine, am now (post-upgrade) having all sorts of problems with getting some (but not all) packages to compile (either during an initial install attempt, or upgrade to existing packages). For example, if I try to