Displaying 20 results from an estimated 800 matches similar to: "buffering output to the console"
2011 Jun 27
3
assign using =
Hey all,
I learned that using the equals sign "=" to assign objects is generally OK, but will not work in some cases.
As I always use "<-" for assignments, I have not encoutered any problems.
Could somebody provide an example or explanation, why getting used to "=" is not a good idea?
Or is it?
Thanks ahead,
Berry
-------------------------------------
Berry
2014 Feb 03
1
seq range argument
Hello dear developers,
I find myself often having the result of "range" oder "extendrange", which I want to create a sequence with.
But "seq" needs two seperate arguments "from" and "two".
Could an argument "range" be added?
Otherwise I will have to create an object with the range (may come from a longer calculation), index twice from
2011 Sep 07
1
access objects
hi,
say I have consecutively numbered objects obj1, obj2, ... in my R workspace.
I want to acces one of them inside a function, with the number given as an argument.
Where can I find help on how to do that? Somebody must have been trying to do this before...
Some keywords to start a search are appreciated as well.
Here's an example, I hope it clarifies what I'm trying to do:
obj1 <-
2012 Jul 18
1
check whether connection can be opened
Hi all,
I'm working on a function that reads online data that is only available to certain IPs. It then writes a subset of the data into a file.
So whenever I'm logged in elsewhere or am not connected to the internet, I get an error, and the function is terminated.
I want it to rather print a message into the file.
Is there any way to test whether a connection can be opened?
Analogous to
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
2012 Jun 28
4
Printing a variable in a loop
Dear R Users:
I'm a STATA user converting to R, and I'd like to be to do the following.
#Assign var_1 and var_2 a value
10->var1
20->var2
#Now I'd like to print the values of var_1 and var_2 by looping through
var_1 and var_2 in such a manner:
while(y<3){
print(var_y)
y+1->y
}
In STATA, the "y" appended to " var_" is called the local variable and
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 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]
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
2012 Mar 05
2
changing the drawing context using Cairo and RGtk2
I am not too familiar with Cairo and RGtk2 and have the following problem:
I have a container with two GTK drawing areas converted into Cairo devices.
I know that I can set the current drawing context e.g. using dev.set().
But this is tedious. How can I set the context using the objects da1 or da2?
w <- gtkWindow()
w$setSizeRequest(400, 400)
vbox <- gtkVBox()
da1 <- gtkDrawingArea()
2011 Dec 22
1
RGtk2: How to overlay a gtkDrawingArea with a button or any other widget?
I try to overlay a plot inside a gtkDrawingArea with a button (or any other widget).
I tried to put both into a gtkFixed container.
But this does not work, no printing occurs.
Does someone know a solution?
What I tried:
w <- gtkWindow()
w$setSizeRequest(400,400)
fx <- gtkFixed()
da <- gtkDrawingArea()
fx$put(da, 100, 100)
asCairoDevice(da)
par(mar=c(0,0,0,0))
plot(1:10)
btn.1
2011 Oct 25
1
R fails when converting units using Hershey-Fonts
I run into some problems when trying to convert units using Hershey-Fonts: R chrashes.
> library(grid)
> label <- "some text"
> pushViewport(viewport(gp=gpar(fontfamily="HersheySerif")))
> convertHeight(stringHeight(label), unitTo="mm")
*** caught segfault ***
address 0xadc838f8, cause 'memory not mapped'
Traceback:
1:
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:
2010 Mar 11
1
modifying the dots argument - how?
Is there a way to modify the dots-argument?
Let's consider I have a function that passes on its ... arguments to
another function.
For some reason I know, that some elements in ... will cause problems.
Can I modify the ... structure somehow, e.g. delete elements?
foo <- function(...){
innerFoo <- function(...){
}
AT THIS POINT I WANT TO MODIFY THE CONTENT OF ... BEFORE IT IS
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
2010 Dec 08
2
S4 "["-method called twice - why?
Dear list,
When playing around with the "[" method for S4 classes I noticed that it gets called twice in my example.
setClass("testClass",
representation(a="character"))
setMethod("[", signature(x = "testClass", i = "ANY", j="ANY"),
function (x, i, j, ..., drop){
print("void function")
2011 Sep 08
1
problem with math expressions in grid graphics when using line breaks (\n)
I want to plot a multiline annotation including a mathematical expression using grid graphics (grid.text).
This works fine for a single line, but the math expression is misplaced when I insert a line break ("\n" escape sequence):
grid.text(expression(paste("Some words here\n more ", sigma)))
Does someone have an idea how to fix that?
TIA!
Mark
2011 Dec 18
1
gWidgets: how to remove that is box drawn when moving the mouse with pressed button
Hi,
how can I omit the box drawn from the starting position to the current position
of the mouse when clicking and it over a GTK graphics object?
I have seen that in the 'playwith' package the box changes to an arrow when
using the 'pan' button. But I do not find the corresponding line in the code to implement that.
library(gWidgets)
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