similar to: Storing user-defined R functions

Displaying 20 results from an estimated 10000 matches similar to: "Storing user-defined R functions"

2008 Jul 20
4
drawing segments through points with pch=1
Please excuse me for asking such basic questions: Here is my code > y=c(1.21,0.51,0.14,1.62,-0.8,0.72,-1.71,0.84,0.02,-0.12) > ybar=mean(y) > ll=length(y); > ybarv=rep(ybar,ll) > x=1:ll > plot(x,ybarv,pch=1) > segments(x[1],ybar,x[ll],ybar) What I get is a collection of small circles, with a segment "on top" of the circles, which is almost what I want. But I
2013 Sep 02
1
Sweave: printing an underscore in the output from an R command
I am working with Sweave and would like to print out into my latex document the result of the R command version$platform So what I first tried in my .Rnw document was \Sexpr{print(version$platform)}. However, the output from this command is the string "x86_64-apple-darwin10.8.0" (without the quotes). This contains an underscore, which is a special character in tex and so I get an error
2008 Sep 10
4
re flecting a line
Suppose x and y are numeric vectors of the same length. plot(x,y) #scatterplot lmObj1 <- lm(y~x) # best fit line abline(lmObj1) # good lmObj2 <- lm(x~y) #get best fit but with axes interchanged abline(lmObj2) # not what I want. I want the correct line, drawn on the same graph, but with # response and predictor variables interchanged One way to proceed would be to
2010 Apr 09
4
perhaps regular expression bug with | sign ??
Here is my interaction with R: > sub(x='>|t|',pattern = '|t',replacement='zz') [1] "zz>|t|" So I say to myself "Clearly the | signs need to be escaped, so let's try this" > sub(x='>|t|',pattern = '\|t',replacement='zz') [1] "zz>|t|" Warning messages: 1: '\|' is an unrecognized escape in a
2009 Feb 05
2
eliminating control characters from formatted data files
I have a few hundred files of formatted data. Unfortunately most of them end with a spurious CONTROL-Z. I want to rewrite the files without the spurious character. Here's what I've come up with so far, but my code is unsafe because it assumes without justification that the last row of df contains a control character (and some NAs to fill up the record). options(warn=-1) #turn off
2010 Dec 14
1
colour-plot of point intensities?
Hi, I've spent a while scrabbling around at this problem, to no avail. I'm sure there /should/ be a simple answer... I have a large (14 million rows) data set, with two columns. Each row contains the number of times an individual moved, and the distance that individual moved in total. I would like a figure where the colour indicates the density of points, rather like this one my
2008 Jul 20
1
Error in edit(name,file,title,editor)
Can anyone help me with the following attempt to use an external editor from within R > vi(file="p286.R") Error in edit(name, file, title, editor) : unable to open file to read > edit(file="p286.R") Error in edit(name, file, title, editor) : unable to open file to read I have only recently re-started trying to learn R. (I tried before but failed.) I am working
2010 Apr 06
3
appending an R-object to a list
How do I append an R-object to a list? I want to start with an empty list, and append R-objects one by one. Does this start with a command like mylist <- NULL ?? I have read a few answers on R-help to questions like this, but they all seem to be well off the point. Sometimes it's assumed that the list is a vector---not my case. One answer I read said that the object appended must be a
2011 Mar 21
1
Sweave, white space and code blocks
Sweave is very useful, and I'm gradually getting used to it. I've just been battling Sweave over the re-use of code chunks. As I am pretty ignorant in the byways of both Sweave and R, this took a chunk of time to sort out. Here is what I learned: If one re-uses a code chunk, then Sweave (but not Stangle) will insist that <> start in column 1. In particular, white space to its left
2011 Apr 16
1
Sweave, SweaveHooks and printing the label
I would like to print the label of each code chunk, just before printing the code chunk itself. Is that possible using SweaveHooks, or by some other mechanism? Thanks David -- View this message in context: http://r.789695.n4.nabble.com/Sweave-SweaveHooks-and-printing-the-label-tp3453829p3453829.html Sent from the R help mailing list archive at Nabble.com.
2010 Apr 08
3
how does one print code
There is quite a long piece of code defining a certain function in one of the R packages. I think the code has a bug and I want to get the code into a file so that I can take a proper look, and possibly fix it. how does one do this? (I mean getting the code into a file, not fixing the bug.) I suppose I could copy and paste, but that's a bit error prone for various reasons. I want the same
2009 Feb 02
3
Environmental variables
I use a Mac (10.4.11 Mac Os X). In my .tcshrc I define an environmental variable MY. Is it possible to find out its value from inside R? When one loads R for Mac OS X Cocoa GUI written by: Simon Urbanek Stefano M. Iacus are files like .tcshrc read by R? Can I make the value of this environmental variable available to R? Sys.getenv() produces a lot of output, with the values of many
2004 Aug 17
0
[LLVMdev] JIT API example (fibonacci)
Valery, That's pretty cute actually. Do you want this "brilliant" :) example in the cvs repository? I'd be happy to put it in. Reid. Valery A.Khamenya wrote: > Hi LLVMers, > > the example attached I have used to prove that JIT and some visible > optimizations are really invoked. > > Proved OK. I got 30% speed-up in comparison to gcc 3.3.3 >
2004 Aug 17
5
[LLVMdev] JIT API example (fibonacci)
On Tue, 17 Aug 2004, Reid Spencer wrote: > That's pretty cute actually. Do you want this "brilliant" :) example in the cvs > repository? I'd be happy to put it in. Here's an idea: how about we take the ModuleMaker, Valery's previous example, and this one and put them all in one "small examples" project? -Chris > Valery A.Khamenya wrote: > >
2004 Aug 17
0
[LLVMdev] JIT API example (fibonacci)
On second thought, the makefiles don't (easily) allow this do they? You can only build one program per directory. Were you suggesting that you wanted me to move the entire directories under a "small examples" directory? Reid. Chris Lattner wrote: > On Tue, 17 Aug 2004, Reid Spencer wrote: > > >>That's pretty cute actually. Do you want this
2004 Aug 18
1
[LLVMdev] JIT API example (fibonacci)
On Tue, 17 Aug 2004, Reid Spencer wrote: > On second thought, the makefiles don't (easily) allow this do they? You can > only build one program per directory. Were you suggesting that you wanted me to > move the entire directories under a "small examples" directory? You're right. The simples way to do this would be to have: projects/ SmallExamples/
2016 Oct 21
4
llvm build failed on Fedora 24
Hi, I'm try to build llvm on my PC but it failed. I'm using following command, $ cmake -G "Ninja" ../llvm -DCMAKE_INSTALL_PREFIX=prefix=$INSTALL_PATH -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_ASSERTIONS=On $ ninja-build -j 2 I have skipped libcxx and libcxxabi package. It shows below error, 00:04:23 [3261/3430] Building CXX object
2005 Sep 10
1
FreeBSD 7.0-CURRENT and R-2.2.0 alpha
The configure script runs fine, but when I compile todays alpha version of R-2.2.0 (R-alpha_2005-09-10_r35546.tar.gz) under FreeBSD 7.0-CURRENT from Sept. 4th I get the following output: ======================================================== [...] gcc -I../../src/extra/zlib -I../../src/extra/bzip2 -I../../src/extra/pcre -I. -I../../src/include -I../../src/include -I/usr/local/include
2006 Jun 12
1
r's optim vs. matlab's fminsearch
Hi, I'm having a problem converting a Matlab program into R. The R code works almost all the time, but about 4% of the time R's optim function gets stuck on a local minimum whereas matlab's fminsearch function does not (or at least fminsearch finds a better minimum than optim). My understanding is that both functions default to Nelder-Mead optimization, but what's different about
2007 May 07
1
looking for equivalent of matlab's medfilt1 function
Dear all, I have several files with Matlab code, which I am translating to R. For the zero-level approach, I took the very old shell script from R-help archives, which has made some obvious leg-work such as replacement of "=" with "<-". Now I am translating indexing, matrix operations and function call using this table http://37mm.no/mpy/octave-r.html The problem is, I