similar to: continuation lines in R script files

Displaying 20 results from an estimated 10000 matches similar to: "continuation lines in R script files"

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
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,
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 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 Jul 29
1
R | vnc | X11 fonts
Greetings - Users of the box I'm putting together will need to be able to run R remotely, using a virtual desktop. One approach (that I'm trying) is to use VNC. So far, I can get the remote gnome desktop up on the server (running Fedora Core 5), and can start R from a terminal. However, for a lot of the R scripts I've tried, I get 'font errors' - the general error message
2017 Sep 28
3
building random matrices from vectors of random parameters
Thanks for both the mapply and array approaches! However, although intended to generate the same result, they don't: # mapply approach n = 3 sa <- rnorm(n,0.8,0.1) so <- rnorm(n,0.5,0.1) m <- rnorm(n,1.2,0.1) mats = mapply(function(sa1, so1, m1) matrix(c(0,sa1*m1,so1,sa1),2,2,byrow=T), sa, so, m, SIMPLIFY = FALSE) print(mats) [[1]] ????????? [,1]????? [,2] [1,] 0.0000000
2017 Sep 28
0
building random matrices from vectors of random parameters
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 > > n = 3 > sa <- rnorm(n,0.8,0.1) > so <- rnorm(n,0.5,0.1) > m <- rnorm(n,1.2,0.1) > mats = mapply(function(sa1, so1, m1) > matrix(c(0,sa1*m1,so1,sa1),2,2,byrow=T),
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
2012 Dec 19
2
probability of binary data
Hi, how are you? I am trying to replicate the binary data f(2) function in the attached document by starting with the simple example found below: observed <- matrix(c(0, 1, 0, 0, 1, 1, 1, 0, 0),3,3,byrow=TRUE) data <- matrix(c(1, 1, 0, 0, 1, 0, 0, 0, 1),3,3,byrow=TRUE) f2 = sum(probability of the matrix element where the matrix element is present in both the observed and 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
2011 Aug 30
1
algorithm to merge same entries in a matrix
Hi, I have the following, rather unorthodox problem: I have a matrix that looks like this: m1 <- matrix(c('a','b','d',NA,'c','c'), 2,3, byrow=TRUE) [,1] [,2] [,3] [1,] "a" "b" "d" [2,] NA "c" "c" now I would like to transform this matrix into this matrix: [,1] [,2] [,3]
2006 Sep 12
1
TAB characters in subject header continuation/wrap lines
I have some emails where the Subject line has been wrapped, and subsequent lines are indented with TAB characters. Specifically, here's a dump of a portion of an email: 0002020 C c : sp nl S u b j e c t : sp [ B 0002040 u i l d b o t ] sp B u i l d B o 0002060 t sp S U C C E S S nl ht ( B l d _ 0002100
2008 Apr 12
3
Matrix Indexing
Hi Does anyone know how I might pick out diagonal elements of a matrix using a vector? If I create a matrix a: a <- matrix(c(1:16), 4, byrow=TRUE) and I want to pick out the elements (1,1),(2,2),(3,3), or another arbitrary diagonal (upper or lower), is there any way I can use a vector to do this? So if I want a diagonal of size 3, I could create a vector like x <- c(0:2) and then pick
2009 Apr 27
2
How to create a graph layout?
I all, I want to create a graph layout in a 3x3 matrix like this: ylab |__| |__| |__| ___ ___ ___ ylab |__| |__| |__| ___ ___ ___ ylab |__| |__| |__| xl xl xl With this layout, then I'll insert the 9 plots. How ca I create it? -- CdeB
2004 Oct 29
1
[rmetasim] Need help deciphering this error msg... targeted to those who use rmetasim...
Hello, I am trying to do some simulation using the rmetasim package and I've run to this problem. --beginning of error msg-- Error in "[<-"(`*tmp*`, slice[l, ], slice[l, ], value = c(0.200000002980232, : number of items to replace is not a multiple of replacement length --end of error msg-- Here is the script I used. --script starts here-- ## load 'rmetasim'
2017 Jul 05
4
expand gridded matrix to higher resolution
Hi all, (if me email goes out as html, than my email client don't do as told, and I apologies already.) We need to downscale climate data and therefore first need to expand the climate from 0.5deg to the higher resolution 10min, before we can add high resolution deviations. We basically need to have the original data at each gridcell replicated into 3x3 gridcells. A simple for loop can do
2012 Nov 30
3
repeating matrices in a list
Suppose I have the following square, non-negative matrices > g=matrix(c(0,2,4,0.25,0,0,0,0.6,0),3,3,byrow=T); I want to create a list where this matrix is repeated multiple times. if I do this brute force (manually), using > env <- list(g,g,g) works fine. Yields [[1]] [,1] [,2] [,3] [1,] 0.00 2.0 4 [2,] 0.25 0.0 0 [3,] 0.00 0.6 0 [[2]] [,1] [,2] [,3] [1,]
2010 Sep 21
5
Combined plot: Scatter + density plot
Hi, in order to save space for a publication, it would be nice to have a combined scatter and density plot similar to what is shows on http://addictedtor.free.fr/graphiques/RGraphGallery.php?graph=78 I wonder if anybody perhaps has already developed code for this and is willing to share. This is the reproducible code for the histogram version obtained from the site: def.par <-
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
2005 Jun 14
1
Matrix stability problem
Hello, This is not a problem with R, the calculated results are mathematically correct. This a matrix stability problem. Because of measuring errors, my matrix solution is a bit off. Here is what my equations look like: A11 x11+A12 x12 +A13 x13 = b1 A21 x21+A22 x21 +A23 x23 = b2 A31 x31+A32 x31 +A33 x33 = b3 A is a reading, X is a measured weight, and b is total. The 3 experiments give