similar to: difference between the meaning of MARGIN in sweep() and apply()

Displaying 20 results from an estimated 400 matches similar to: "difference between the meaning of MARGIN in sweep() and apply()"

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 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 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
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 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 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:
2012 Apr 05
3
Apply function to every 'nth' element of a vector
Dear R users, how do I e.g. square each second element of a vector with an even number of elements? Or more generally to apply a function to every 'nth' element of a vector. I looked into the apply functions, but found no hint. For example: v <- c(1, 2, 3, 4) mysquare <- function (x) { return (x*x) } w <- applyfun(v, mysquare, 2) then w should be c(1, 4, 3, 16) Thanks for
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
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
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,
2006 Dec 07
6
form_tag not producing output
I''ve got two servers, both with Rails 1.1.6 on them. I''m trying to remove some of the newly-deprecated stuff in my app, and I''ve run into a problem. My login page used to look like this: <div title="Account login" id="loginform" class="form"> <h1>Please Sign In</h1> <%= start_form_tag :action =>
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
2009 Jan 18
3
ActionMailer and url_for in helper methods
Hi, I was wondering how to get url_for to work inside ActionMailer. I did research on the web but I can''t seem to find something that fits what I need. In my application, each user can specify their custom domain to access their. I have an ActionMailer that sends them notifications of changes that occur. In there, I have a breadcrumbs helper method, which generages something like:
2010 Jan 19
1
Error compiling R 2.10.1 on AIX
I'm trying to compile R 2.10.1 on AIX 5.3, and am getting the following error: Error in read.dcf(file = descfile) : Line starting 'Package: tools ...' is malformed! Calls: makeLazyLoading ... code2LazyLoadDB -> loadNamespace -> parseNamespaceFile -> read.dcf Execution halted make[3]: *** [all] Error 1 make[3]: Leaving directory
2000 May 22
2
Problem with "force create mode" et. al.
Hi, folks. I've got a weird situation here. I'm sure it's something small, but, well, either I've been cursed by a witch doctor, or my eyesight is getting too bad to find small problems. Either way, I'm more than willing to be pummeled for asking such a stupid question, as long as it helps me get it solved. I'm replacing an NT file server with a Samba box (hooray!).
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