similar to: Looping multiple output values to dataframe

Displaying 20 results from an estimated 1000 matches similar to: "Looping multiple output values to dataframe"

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
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
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
2007 Nov 29
1
Question about using “par”
Hi, Sorry for bothering your guys again. I am trying to use "par" to put 6 figures into 3 rows and 2 columns. My code is: op <- par(mfrow = c(1, 2)) xyplot(x1+x2+x3 ~ y, data=resulta, type="l", pch=LETTERS[1:3], lty=c(1:3), main="For k=3, theata1=1") xyplot(x1+x2+x3 ~ y, data=resultb, type="l", pch=LETTERS[1:3], lty=c(1:3), main="For k=3,
2009 Apr 02
0
multiple annotations on a heatmap
Can someone recommend a more sophisticated way to annotate heatmaps than the ColSideColors argument of heatmap and heatmap.2? In particular, I would like to be able to annotate columns with more than one piece of information, like in Figure 1 of the article at http://www3.interscience.wiley.com/cgi-bin/fulltext/117905619/HTMLSTART / doi:10.1002/hep.22256. Some example data and a heatmap:
2008 Mar 23
3
"spreading out" a numeric vector
I am creating a timeline plot, but running into a problem in positions where the values to plot are too close together to print the text without overlap. The simplest way I can think of to solve this (although there may be other ways?) is to create a new numeric vector whose values are as close as possible to the original vector, but spread out to a given minimum difference. For example, take
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
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
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
2017 Jun 01
4
Upper bands and lower bands
Hi all I want to add a band of fluctuaci?n (exponential decreading) to a linear deacrecing values Imagine: I have a matrix like c(10,9,8,7,6,5,4,3,2,1) The thing is I want two new lines so that the m?ximum value of the new colum on the m?ximum is from 10% to 5% higher and the same lower for the m?nimum the final two matix will be something like c(10+0.10*10,9+0.089*9,8+0.075*8.....,1+0.05*1)
2017 Jun 01
0
Upper bands and lower bands
I explain better: I have this percentage z<-1/(n*365) where n=20 so z is 0,000136986 Imagine: a matrix with length(n*365) so that matrix result is resultc( 1, 1-z result previous row-z result previous row-z .... 0) If I plot this is a linear decreasing line I want to plot an upper line wich is 10% higher tan resultc on the first values and then decreasing so that last value will be 0.05.
2009 Oct 12
4
Re use objects from within a custom made function
Hi everyone, i'm having a problem extracting objects out of functions i've created, so i can use them for further analysis. Here's a small example: # --------------------------- test <- function(i, j){ x <- i:j y <- i*j z <- i/j return(x,y,z) } # --------------------------- This returns the 3 objects as $x, $y and $z. I cannot, however, access these objects
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
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
2012 May 24
3
PXE looping on localboot
I have seen posts about this problem, but have had trouble finding how/if it was resolved. I am trying to upgrade from syslinux-3.11 to syslinux-3.86 on RHEL5. On 3.86, when it performs a local boot from hard disk, it just keeps looping back into PXE boot again instead of booting from the hard disk. It will perform a system install just fine, but when it switches to localboot after the install,
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