Displaying 20 results from an estimated 1000 matches similar to: "modifying the dots argument - how?"
2009 Dec 02
2
Reordering the results from table(cut()) by break argument
I have a vector and need to count how many data points fall inside
each bin:
dat <- rnorm(100)
breaks <- -3:3
table((cut(dat, breaks)))
(-3,-2] (-2,-1] (-1,0] (0,1] (1,2] (2,3]
3 13 42 30 12 0
if I reverse the breaks vector, the results remains the same:
breaks <- rev(breaks)
table((cut(dat, breaks)))
(-3,-2] (-2,-1] (-1,0] (0,1] (1,2]
2010 Jan 01
2
changing a list element's name during execution in lapply - possible?
Happy New Year, all!
I want to do calculations on each element of a list l, but i want the
returned list element to be named differently after the calculation.
Is it possible to do the renaming somehow within the lapply call?
l <- list(a=NA, b=NA)
lapply(l, function(x) {names(x) <- "new name"; return(x) })
This does not work, any ideas?
TIA
2009 Dec 27
2
RGtk2 / gWidgets - addHandlerClicked Problem
In The following code, the table handler is executed twice when the
button is pressed (from the 2nd pressing on).
I want it to be executed only once. Does someone know, why this
happens and how I can change it?
library(gWidgets)
w <- gwindow()
b <- gbutton("press", cont=w)
tbl <- gtable(1:10, cont=w)
addhandlerclicked(b, handler=function(h, ...){
2009 Dec 27
1
gWidgets / RGtk2 - how to change a handler from a toolbar?
I want to assign a default handler to a toolbar button and change the
handler later.
The addhandlerclicked() method does not apply to a gAction Object, I
think...
defHandler <- function(h, ...) print("default")
w <- gwindow()
aTest <- gaction(label="Test", icon="open", handler=defHandler)
tblList = list( test = aTest )
toolBar = gtoolbar(tblList,
2010 Jan 08
1
how to flatten a list to the same level?
I have a nested list l like:
l <- list(A=c(1,2,3), B=c("a", "b"))
l <- list(l,l, list(l,l))
I want the list to be unlisted, but not on the lowest level of each
"branch".
I want the lowest level of each list branch to remain as it is.
So unlist or unlist(rec=F) do not work here as the level of nesting
may differ on the elements.
The result should look like:
2009 Dec 22
1
RGtk2 - retrieve ggraphics mouse coordinates during drag-and-drop event
Hi all,
I have a gtable and a ggraphic widget.
I want to drag an element from the table onto the graphic.
When the drag object is released over the ggraphic widget, I want the
mouse coordinates inside the ggraphic to be returned.
Right now I do not know how to get the mouse ccordinates of the
ggraphic widget at any given time.
How can I access the ggraphics mouse coordinates?
Below you find
2010 Feb 14
3
evaluate variable within expression - how?
Ein eingebundener Text mit undefiniertem Zeichensatz wurde abgetrennt.
Name: nicht verf?gbar
URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20100214/4b41a017/attachment.pl>
2011 May 19
0
Flattening lists and environments (was: "how to flatten a list to the same level?")
Dear list,
I came up with a two functions that flatten arbitrary deeply nested
lists (as long as they're named; not tested for unnamed) and
environments (see attachment; 'flatten_examples.txt' contains some
examples).
The paradigm is somewhat similar to that implemented in 'unlist()', yet
extends it. I would have very much liked to build upon the superfast
functionality
2009 Oct 28
1
write to RTF format - possible?
Hi everybody,
To write a .txt file I use write.table()
Is there a way to write to a .rtf file as well?
TIA
Mark
???????????????????????????????????????
Mark Heckmann
Dipl. Wirt.-Ing. cand. Psych.
Vorstra?e 93 B01
28359 Bremen
Blog: www.markheckmann.de
R-Blog: http://ryouready.wordpress.com
2010 Oct 30
1
overloading "[" and "[<-" using S3 classes
How can I overload the "[" and "[<-" operators using S3 classes?
Something like '['.{class} did not work or at least I do not know how to define it properly.
For S4 it is straightforward:
setMethod("[", signature(x = "myClass", i = "numeric"),
function (x, i, j, ..., drop){
... some operations
})
How to do the same for S3?
TIA!
2010 Nov 20
3
how to store package options over sessions?
Hi,
I posted this a week ago on r-help but did not get an answer. So I hope that someone here can help me:
I want to define some options for my package the user may change.
It would be convenient if the changes could be saved when terminating
an R session and recovered automatically on the next package load.
Is that possible and if yes, is the standard way to implement this?
Thanks,
Mark
2010 Aug 13
1
RDCOMClient interface - problems setting a variable
I try to produce and modify shapes in a PowerPoint presentation but run into a difficulty setting a variable.
library(RDCOMClient) # load RDCOMClient package
library(SWinTypeLibs) # package SWinTypeLibs from Omegahat to access information about COM libraries
ppt = COMCreate("PowerPoint.Application") # create a ppt COM
ppt[["Visible"]] <- TRUE # set COM
2010 Jan 21
0
sp package - How to join two or more polygons from a SpatialPolygonsDataFrames
I have a SpatialPolygonsDataFrame object (sp package).
It contains 40 polygons.
Now I want to join some of the polygones.
I cannot figure out how to do that? Any ideas?
The code below produces a map of Germany and I need to join some
counties.
library(sp)
library(RColorBrewer)
# get spatial data for Germany on county level
con <- url("http://gadm.org/data/rda/DEU_adm3.RData")
2010 Feb 23
1
latent class factor analysis (LCFA) in R?
Ein eingebundener Text mit undefiniertem Zeichensatz wurde abgetrennt.
Name: nicht verf?gbar
URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20100223/a37194ac/attachment.pl>
2010 Nov 20
1
Roxygen examples in DONTRUN mode - how?
Dear list,
I have just started to use roxygen and cannot find out how to specify NOT RUN examples.
I know that to include R code examples works via the @examples tag followed by the code.
Without roxygen, if I want R code not to be run when processing the .Rd files I would include the \dontrun tag
\examples{\dontrun{ ... some example R code} }
How can I achieve this using roxygen?
Thanks
Mark
2012 Mar 05
2
no partial matching of argument names after dots argument - why?
I noticed that the argument names after the dots argument are not partially matched.
foo <- function(one, two, ...){
one + two
}
> foo(o=1, t=2)
[1] 3
foo <- function(one, ..., two){
one + two
}
> foo(o=1, t=2)
Fehler in one + two : 'two' fehlt
Can someone explain me the reason for this behavior?
THX
Mark
????????????????????????????????????
Mark Heckmann
Blog:
2009 Jun 08
3
using regular expressions to retrieve a digit-digit-dot structure from a string
Hi,
i need to recognize itemization structures in strings which follow the
format: "digit-digit-dot" like e.g.
1.
2.
19.
211.
Given the string " This happened in the 21. century." (the dot behind 21 is
used in German instead of 21st) I want know where the dots are but I do not
want the 21.-dot to be returned as well.
I am not good at regular expressions. How
2010 Nov 19
3
all extended ASCII characters exist for R console output?
Ein eingebundener Text mit undefiniertem Zeichensatz wurde abgetrennt.
Name: nicht verf?gbar
URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20101119/71f56846/attachment.pl>
2011 Apr 25
4
blank space escape sequence in R?
Is there a blank space escape sequence in R, i.e. something like \sp etc. to produce a blank space?
TIA
Mark
???????????????????????????????????????
Mark Heckmann
Blog: www.markheckmann.de
R-Blog: http://ryouready.wordpress.com
2012 Mar 08
3
"figure margins too large" in RGtk2 drawing area as cairo device - why?
When using a gtkDrawingArea as a Cairo device I very often encounter the error: "figure margins too large"
Even for the below "getting started" example from http://www.ggobi.org/rgtk2/ this is the case.
> win = gtkWindow()
> da = gtkDrawingArea()
> win$add(da)
> asCairoDevice(da)
[1] TRUE
> plot(1:10)
Fehler in plot.new() : Grafikr?nder zu gro?
>
Also