similar to: "spreading out" a numeric vector

Displaying 20 results from an estimated 10000 matches similar to: ""spreading out" a numeric vector"

2009 Feb 12
3
getting all pairwise combinations of elements in a character string
I'm able to do this as follows, but am wondering if anyone knows a simpler way which still avoids explicit loops? > (mystring <- letters[1:5]) [1] "a" "b" "c" "d" "e" > unlist(sapply(mystring[-length(mystring)], + function(x) paste(x,mystring[(grep(x,mystring)+1):length(mystring)],sep=""))) a1 a2 a3
2009 Aug 27
2
setting par(srt) according to plot aspect ratio
How can I look up the aspect ratio of a plot, so I can use that to correctly adjust the angle of text which is supposed to be parallel to a line in the plot? The following example code works for a 1:1 aspect ratio, but puts the text at the wrong angle if the plot region is short and wide or tall and narrow. I can't find a par() component containing the plot aspect ratio. It will be for
2009 Aug 31
3
Two way joining vs heatmap
Hi STATISTICA has a function called "Two-way joining" (see http://www.statsoft.com/TEXTBOOK/stcluan.html#twotwo) and the reference material states that this is based on the method as published by Hartigan (found this paper: http://www.jstor.org/pss/2284710 through wikipedia). What is the relationship (if any) between the "heatmap" function in R and this technique? Is there an
2008 Mar 05
2
differentiating a numeric vector
What functions exist for differentiating a numeric vector (in my case spectral data)? That is, experimental data without an analytical function. ie, > x <- seq(1,10,0.1) > y=x^3+rnorm(length(x),sd=0.01) #although the real function would be nothing simple like x^3... > derivy <- .... I know I could just use diff(y) but it would be nice to estimate derivatives at the
2009 Feb 12
3
Looping multiple output values to dataframe
Dear R users, I have various vector geometry operations to perform on 3-D coordinate data located on multiple (500+) csv files. The code I have written for the calculations works just fine. I have written a 'for' loop to automate the task of extracting the coordinates from the files and perform the analyses. The loop works reasonable well, but if the number of csv files is greater than
2009 Dec 16
1
difference between the meaning of MARGIN in sweep() and apply()
For example, subtracting 1:2 from the rows of a two-column matrix: > t(apply(matrix(1:6,ncol=2),MARGIN=1,function(y) y - 1:2)) [,1] [,2] [1,] 0 2 [2,] 1 3 [3,] 2 4 > sweep(matrix(1:6,ncol=2),MARGIN=2,1:2,FUN="-") [,1] [,2] [1,] 0 2 [2,] 1 3 [3,] 2 4 Is there a logic to this difference, or is it just a quirk of the history of these
2008 Jun 27
3
cumulative sum of within levels of a dataframe
This one should be easy but it's giving me a hard time mostly because tapply puts the results in a list. I want to calculate the cumulative sum of a variable in a dataframe, but with the accumulation only within each level of a factor. For a very simple example, take: > df <- data.frame(x=c(rep(1,5),rep(2,5),rep(3,5)),fac=gl(3,5,labels=letters[1:3])) > df x fac 1 1 a 2 1 a
2018 Mar 19
2
What is the status of the "Killing Undef and Spreading Poison" RFC?
Hi, Back in 2016 an RFC titled "Killing Undef and Spreading Poison" [1] was posted on this mailing list, which generated a lot of discussion between different people. Later in 2017, a paper titled "Taming Undefined Behavior in LLVM" [2] was published, detailing the various concerns introduced in the RFC. There is also a patch proposal with an initial implementation
2009 Mar 17
1
breaking ties in order() based on many vectors
The order() function allows you to specify multiple vectors, which are used successively to break ties. If I want to use many vectors to break ties (say, 25 or more), that are columns of a matrix or elements of a list, does anyone know a shortcut to do this without passing 25 arguments to order()? -- Levi Waldron post-doctoral fellow Jurisica Lab, Ontario Cancer Institute Division of Signaling
2008 Jul 18
3
"Spreading risk" in a matrix
I have a binary matrix that represents a map of invasive species risk (1 = infested; 0 = uninfested). It started as a matrix of probabilities (developed in ArcMap) that I converted to binary with this R code: binary.matrix<-matrix(rbinom(length(prob.matrix),prob=prob.matrix,size=1),nrow=nrow(prob.matrix)) Now, I would like to "spread" the risk for year 2 of the invasion. I'd like
2014 Dec 31
1
Unexpected behavior of debug() in step-wise mode
Why does debug() enter Browse[3] here at all, and why does it happen the first time and not the second? This seems unexpected to me, and has undesirable effects for ESS users (that I reported here - https://stat.ethz.ch/pipermail/ess-help/2013-June/009154.html - but just realized my post to r-devel didn't make it through when I tried to report it back then). > Fun <- function(n)
2008 Mar 31
1
adding device size-independent y=0 line to a lattice plot
Using the following lattice plot as an example, I would like to add horizontal lines where y=0: library(lattice) library(grid) fac <- gl(4,12) x <- letters[rep(1:3,16)] y <- runif(48,min=0.0) dotplot(y~x|fac) I've tried it with grid.lines using npc and native units, which works fine unless I change the size of the output device - then the lines are in the wrong place. Is there a
2008 May 14
1
lw in legend also changes thickness of characters in the legend??
Here's a simple example: x <- 1:5 plot(x,x^2) lines(x,x^2) points(x,x,cex=2) lines(x,x,lw=3) legend("topleft",legend=c("y=x^2","y=x"),pch=1,pt.cex=1:2,lw=c(1,3)) The thickness of the circles in the legend changes with lw. If you change the lw argument in legend to lw=c(1,1) then the thickness of the circles goes back to normal. How can I make the above
2011 Jul 01
1
highlighting clusters in a heatmap
I would like to draw horizontal or vertical lines on a heatmap to highlight the clusters at some specified cut depth of the dendrogram. As a hacked example, the following code would work if I could set the coordinates of the top and bottom of the false color image correctly (ymin and ymax), but the correct values seem to depend on the output device and its size. I realize that heatmaps use a 2x2
2007 Nov 22
1
package gsl assumes incorrect gcc version during install (PR#10451)
Full_Name: Levi Waldron Version: 2.5.1 OS: Ubuntu Gutsy Submission from: (NULL) (206.248.157.88) I installed libgsl0-dev then tried to install the gsl cran package, unsuccessfully (see output below). As a workaround I created a symbolic link to /usr/bin/gcc-4.2, ie: sudo ln -s /usr/bin/gcc-4.1 /usr/bin/gcc-4.2 The correct behavior of the gsl package should be to use the executable
2008 Mar 04
2
summarizing replicates with multiple treatments
I have a dataframe with several different treatment variables, and would like to calculate the mean and standard deviation of the replicates for each day and treatment variable. It seems like it should be easy, but I've only managed to do it for one treatment at a time using subset and tapply. Here is an example dataset: > `exampledata` <- structure(list(day = c(1L, 1L, 1L, 1L, 1L,
2006 Apr 19
1
wpa_supplicant and wi
I am using a Netgear MA401 with the wi driver, and am having trouble using wpa_supplicant to set static WEP keys. I have the wlan_wep.ko module loaded with wlan and wi built into the kernel. My wpa_supplicant.conf looks like this: ctrl_interface=/var/run/wpa_supplicant ctrl_interface_group=wheel network={ ssid="INTERNERD" scan_ssid=1 priority=1 key_mgmt=NONE
2005 Feb 25
1
Samba users spreading spam (or automated replies)
Hi Some of the samba users are spreading spam or automated replies. Is there any possible way to stop them? I've got the following two messages after my first post which are either spam or automated nonsense replies: Message 1: From: Jim Crippen <jcrippen@eliteint.com> To: Behrang Saeedzadeh <behrangsa@gmail.com> Date: Fri, 25 Feb 2005 06:21:37 -0600 Subject: Out of Office
2006 May 08
3
OpenGL w/ FreeBSD 6-STABLE and Wine 0.9.12
Hello, I am running FreeBSD 6-STABLE with Xorg 6.9 and Wine 0.9.12 from the ports tree. The DRI extensions are installed and working properly for my ATI X800 AIW, as reported by glxinfo: display: :0 screen: 0 direct rendering: Yes ** snip ** OpenGL vendor string: Tungsten Graphics, Inc. OpenGL renderer string: Mesa DRI R300 20040924 AGP 8x TCL OpenGL version string: 1.2 Mesa 6.4.1 glxgears
2016 Aug 15
2
KMeans - Evaluation Results
Hello, I've recently finished with an implementation of KMeans with two initialization techniques, random initialization and KMeans++. I would like to share my findings after evaluating the same. I have tested this implementation of KMeans with a BBC news article dataset. I am currently working on evaluating the same with FIRE datasets. Currently, clustering more than 500 documents