similar to: really dumb question | loop counters in

Displaying 20 results from an estimated 10000 matches similar to: "really dumb question | loop counters in"

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,
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
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
2006 Sep 27
3
multidimensional lists
In the process of moving a number of my scripts from MATLAB -> R, I've discovered that there is no 'pure' equivalent of MATLAB's cell arrays, which I use quite often. Basically, I create matrices (as a cell array) where each element of the matrix is itself a matrix (e.g., 2x2 cell array where each element of the array is another matrix). I pass these cell arrays to various
2006 Sep 06
3
continuation lines in R script files
When I have to enter a very large matrix into the R console, I can make use of the continuation feature in the console to enter the matrix in pieces (e.g., on a row by row basis). So, for example, the console would show the "+" sign for continuation lines - something like what I've written below: a=matrix(c(0,20,50, + 0.05,0,0, + 0,0.1,0), + 3,3,byrow=T) (obviously, for a
2013 Jan 29
7
Seriously, am I the only one having trouble with the RHEL puppetlabs repos?
This is the third time I''ve sent a message about this. Does anybody know what''s going on? I''m going to file a bug if this isn''t fixed soon. RHEL6: http://yum.puppetlabs.com/el/6/products/x86_64/repodata/primary.sqlite.bz2: [Errno -1] Metadata file does not match checksum Trying other mirror. Error: failure: repodata/primary.sqlite.bz2 from
2003 May 26
4
spinning and flipping arrays
Hello people, Is there some simple way of spinning and/or flipping arrays in R? Here's what I mean. Suppose that foo is a 2x3x4 array with the following contents: (I know this is different than typing 'foo' at and R prompt, but I'm so used to row major order from using APL, I have a hard time with R's output) > foo[1,,] [,1] [,2] [,3] [,4] [1,] 1 2 3 4
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
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 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,
2007 Dec 02
2
Obtuse-smtpd and Postfix
Hi all.. I would like to switch to CENTOS Postfix from sendmail. My current sendmail, in combination with the very old obtuse-smtpd, allows me: 1. To control who of the internal users can send mail and to which domain or accounts 2. To control who of the internal users can receive mail and from which domain or accounts 3. To obtain a copy of all sent mails
2017 Sep 22
2
update numeric values of list with new values...
Suppose I have the following: test <- list(a=1,b=2,c=3) I also have a vector (or list, or something else...) with new numbers new <- c(4,5,6) What I'm trying to figure out is how to take the list, and update the numbers from {1,2,3} to {4,5,6} So, in the end,I want the 'update' test list to look like (a=4,a=5,a=6) I tried a bunch of obvious things I know about
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
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
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 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
2002 Dec 17
4
Quick tip please!
I have two CSV files (exported from Excel), say file1 and file2. The have the same number of rows, and each has several columns, with names on the first line; and some of the columns in file1 are repeated in file2. Using the "foreign" package, I can read these in separately to dataframes say d1 and d2 with > d1<-read.csv("file1") >
2003 Mar 12
7
R help
Dear friends, I work with Matlab and now a bit in trouble with getting used to R. Could you give me some help with the following questions: 1. how to generate the random matrix mxn with constant mean and variance, say N(0,1)? 2. how to create a code (function), say “myfunction”, and make it available for use every time I run R? 3. how to make a package, say “e1071”, available for use
2007 Mar 07
2
Multi-line plots with matrices in R
Hello all, I'm a new user of R, experienced with Octave/MATLAB and therefore struggling a bit with the new syntax. One of the easy things in Octave or MATLAB is to plot multiple lines or sets of points by using a matrix where either the columns or the rows contain the y-values to be plotted. Both packages automatically give each line/points their own unique colour, character etc. I'm
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(~