Displaying 20 results from an estimated 30000 matches similar to: "simple if...else causes syntax error"
2005 Sep 14
1
Long lines with Sweave
I have used Sweave a lot the latest year, but never really used any long
function calls.
If I have code which look like this
-------------------------------------------------------------
gof <- benthic.flux(ID="Gulf of Finland",
meas.conc=conc,
bw.conc=bw.conc,
time=times,
2005 Apr 01
2
about get stdout from other program
Dear all R-helper,
if I want to use stdout from other language as my R program input ,which is
the best way for design the API,using Pipe function or produce a temporary
file,using scan function to read the file ?
thanks
Michael
2017 Jun 14
8
[WISH / PATCH] possibility to split string literals across multiple lines
Hi,
I would really like to have a way to split long string literals across
multiple lines in R.
Currently, if a string literal spans multiple lines, there is no way to
inhibit the introduction of newline characters:
> "aaa
+ bbb"
[1] "aaa\nbbb"
If a line ends with a backslash, it is just ignored:
> "aaa\
+ bbb"
[1] "aaa\nbbb"
We could use
2017 Jun 14
4
[WISH / PATCH] possibility to split string literals across multiple lines
On Wed, 14 Jun 2017 06:12:09 -0500, Duncan Murdoch <murdoch.duncan at gmail.com> wrote:
> On 14/06/2017 5:58 AM, Andreas Kersting wrote:
> > Hi,
> >
> > I would really like to have a way to split long string literals across
> > multiple lines in R.
>
> I don't understand why you require the string to be a literal. Why not
> construct the long
2006 May 19
2
"Pipelining" programs in R
Hello...
I would like to use R for 'pipelining' data among several programs. I'm
wondering how I can use R to call another program, feed that program a set
of parameters, and retrieve the output.
E.g., I have an executable that, when opened, prompts the user to enter a
set of parameters. The program then executes & prompts the user for the
name of an output file. I need to
2017 Jun 14
2
[WISH / PATCH] possibility to split string literals across multiple lines
I don't think it is reasonable to change the parser this way. This is
currently valid R code:
a <- "foo"
"bar"
and with the new syntax, it is also valid, but with a different
meaning. Or you can even consider
a <- "foo"
bar %>% func() %>% print()
etc.
I like the idea of string literals, but the C/C++ way clearly does not
work. The Python/Julia way
2017 Jun 14
2
[WISH / PATCH] possibility to split string literals across multiple lines
Mark, that's actually a fair statement, although your extra operator
doesn't cause construction at parse time. You still call paste0(), but just
add an extra layer on top of it.
I also doubt that even in gigantic loops the benefit is going to be
significant. Take following example:
atestfun <- function(x){
y <- paste0("a very long",
"string for
2005 Apr 12
5
How allocate STRSXP outside of gc
Hi,
I am trying to figure a way to allocate a string SEXP so that gc() won't
ever collect it.
Here is a little bit of a background. Suppose I want to write a
.Call-callable function that upon each call returns the same value, say
mkChar("foo"):
SEXP getFoo() {
return mkChar("foo");
}
The above implementation doesn't take advantage of the fact that
2005 Mar 02
1
R 2.1.0 scheduled for April 18
The release schedule has now been set with a release date on April 18.
The detailed procedure can be found at http://developer.r-project.org/
(it is not quite there yet, but will appear after a short propagation
delay.)
The main point for non-developers is that we start making alpha
tarballs on March 21 and beta tarballs on April 4. Only very simple
and/or critical bugs are fixed in the last
2006 Jul 13
2
VERY TINY question: missing function to clear the console?
Hi,
for presentation purposes I would like to clear to whole console
window (like in a UNIX terminal: 'clear').
Is there such a function?
If not, I could image that is not too hard to write such a function.
Cheers,
Hans
2008 Apr 08
1
Question Regarding 'pipe'
Can anyone point out why this is not working?
y<-read.table(pipe(' awk '{ n = $1; sub( ".*" $1 " " ,"") ; while ( n-- )
print }' temp.txt '))
[[alternative HTML version deleted]]
2008 Jun 09
2
Plot timer in a for loop
Hello,
This code works fine but is so fast I can't see anything but the last plot.
for (i in nrow(X)){
plot(as.numeric(d[i,])) }
I'd like to view a plot every 500 milliseconds, nrow(X) = 400. How?
Thanks
--
View this message in context: http://www.nabble.com/Plot-timer-in-a-for-loop-tp17741975p17741975.html
Sent from the R help mailing list archive at Nabble.com.
2005 Feb 01
1
Process to both write to and read from (pipe/fork)?
Dear all,
I would like to start a process from an R program in such a way that
I can both feed input into the process and read the process's output.
It seems that in R, I can have a pipe for writing into another process's
input or a pipe for reading from another process's output, but not both.
Doing both necessitates forking, such that the child can start the
external process and
2005 Feb 01
1
Process to both write to and read from (pipe/fork)?
Dear all,
I would like to start a process from an R program in such a way that
I can both feed input into the process and read the process's output.
It seems that in R, I can have a pipe for writing into another process's
input or a pipe for reading from another process's output, but not both.
Doing both necessitates forking, such that the child can start the
external process and
2005 Apr 06
2
Precision
How precise is R numerically? For example I
wrote the following function for calculating
the volume of the ball inscribed in the
unit cube in m dimensions. In order to see what
happens in 40 dimensions, I created an output
of 24 digits. But how many are precise?
Thanks
Josef Eschgf?ller
Ferrara
---------------------------------------
Vol = function (m)
{if (m<=1) 1
else Vol(m-2)*pi/(m+m)}
2008 Aug 29
1
nls() fails on a simple exponential fit, when lm() gets it right?
Dear R-help,
Here's a simple example of nonlinear curve fitting where nls seems to get
the answer wrong on a very simple exponential fit (my R version 2.7.2).
Look at this code below for a very basic curve fit using nls to fit to (a)
a logarithmic and (b) an exponential curve. I did the fits using
self-start functions and I compared the results with a more simple fit
using a straight lm()
2006 Dec 15
2
fork package problem
I have been using the fork package on a cluster to spawn jobs. I have
noticed that I end up with many "R defunct" (zombie) processes following
the use of fork that do not die completely until I close down R.
Initially, I thought it may be my code but I ran the example from the
latest fork package (see code below) on R.2.3.1 and ended up with the
same problem. The code from the
2012 Nov 27
2
Stuck trying to modify a function
Hi,
I have the following data:
Path_Number <- 5
ID.Path <- c(1:Path_Number) # Make vector of ID's.
No_of_X <- sample(50:550, length(ID.Path), replace=TRUE) #
X <- split(sample(1:10000, sum(No_of_X), replace=TRUE), rep(ID.Path, No_of_X))
Y <- lapply(X,function(x) sample(x, round(runif(1, min=10, max=50))))
X and Y are both lists, and I've made the following function to
2005 Apr 14
2
Printing integers in R "as is"
Hi,
I am using the following command to print to a file (I omitted the file
details):
cat( paste( paste(orientation, start, end, names,"\n"), paste(start, end,
"exon\n"), sep=""))
where "orientation" and "names" are character vectors and "start" and
"end" are integer vectors.
The problem is that R coerce the integer vectors
2005 Dec 08
3
scoping issues?
Can anyone please help me understand whats happening here?
Thanks
Tom
getAmpRatio<-function(v_amps){
#calculates the amplitude ratios between the 3 largest amps and the
rest
bigamp<-0
map<-rep(TRUE,length(v_amps))
for(iLoc in 1:3){
bigamp<-bigamp+max(v_amps)
map[which.max(v_amps)]<-FALSE
v_amps<-v_amps[map]