similar to: Object-oriented programming in R

Displaying 20 results from an estimated 6000 matches similar to: "Object-oriented programming in R"

2009 May 26
4
Creating multiple graphs based on one variable
Dear List, I would like to create several graphs of similar data. I have x and y values for several different individuals (in this case fish). I would like to plot the x and y values for each fish separately. I can do it using a for loop, but I think I should be using "apply". Please let me know what I am doing wrong, or if there is a "better" way to do this. What I have
2004 Jul 22
2
Files and classes in a package?
While installing my small package, I met a tricky problem. For clarity, let me explain it with the following simplified example. In ~/pkg/R/aclass.R, setClass("aclass", contains="bclass", representation(i="numeric")) In ~/pkg/R/bclass.R, setClass("bclass", representation(j="numeric")) After building a "pkg" package, the file
2011 Mar 06
1
Seeking guidance in package creation when it contains s4 class
Dear all, I am having problem to create a package when this package is supposed to have some newly created s4 class. Here is my workout: > #rm(list = ls()) > setClass("aClass", sealed=T, representation(slot1 = "vector", slot2 = "character")) [1] "aClass" > fn1 <- function(x, y, z) { + x <- x[1] + y <- y[1] + z <- as.character(z[1]) +
2008 Mar 14
2
Multiple should_receive(:render).with
I''m trying to specify that a particular view must render two different partials. My spec looks like: describe AClass do it do template.should_receive(:render).with(:partial => ''foo'', :locals => { ... }) ... end describe ''some conditional case'' do it do template.should_receive(:render).with(:partial =>
2009 Jun 16
1
[LLVMdev] runtime library for jitted code
Victor Zverovich <victor.zverovich at googlemail.com> writes: > The question about the name mangling gave me an idea that it can be used to > automate registration of DLL functions. Instead of manually creating > Function objects specifying a return type and argument types which is > error-prone and time-consuming one can get a list of functions exported from > a DLL using
2009 Apr 14
2
matrix merge problem
Dear r-help contributors, I have two questions: first: I have a matrix A and a vector B. I want to make a new matrix C, which is made of the rows of A having a value included in B. Second: I have two matrixes A and B, of different dimensions. B has unique values in column 2 and A has not unique values on column 2. I want to merge this two matrixes by the values in the columns 2 of B and 2 of
2006 Apr 10
3
Simple act_as template
Hello ! I posted a simple template to show how to add ''act_as_whatever'' to ActiveRecord. I think this might be useful to others as there are some trickery ruby things in this file. Here is the template : http://textsnippets.com/posts/show/384 Gaspard Bucher -- Posted via http://www.ruby-forum.com/.
2009 Apr 07
2
Frequency table to histogram
I have read a frequency table in to R called "temp." I now want to create a histogram table from it, but I obviously first have to expand the data - to the sample size of 100. I want to use the command rep(), but I'm not sure how to go about it..I tried using the code: temp1<-rep(temp$Chest,100) hist(temp1) But this creates a v. odd histogram so I know it must be wrong!
2006 May 22
2
using Singleton with Prototype
Hello all. I''m writing my own object using prototype and I wonder how you write and call only one instance of class. Can anyone share his idea of singleton? thanks Gregor ---------------------------------------------------- Gdy nadchodzi przełomowy moment w historii, musisz zdecydować, po czyjej stronie będziesz. "X-Men: Ostatni bastion" - w kinach od 26 maja.
2006 Aug 03
12
More than one has_many :through association between the same 2 models
I wonder if you can have more than one has_many :through association between 2 models. For example... I have a model Teacher and a model Class Now, 1 Teacher works in many Classes, right?. So I need a join model like class Work < ActiveRecord::Base belongs_to :teacher belongs_to :class end But I also would like to know if a teacher CAN teach a class before I
2010 May 20
1
Kate terminal window
Dear R-users, I've recently switched to Ubuntu and I've decided to use Kate to edit my R code. I really like how Kate allows one to simply pipe their code to the terminal. However, I would find it even better if I could actually get the Kate console to display error messages (or any console outputs in fact) in red and my input in a different color. The instance of xterm that Ubuntu
2009 May 01
1
A beginner's question about ggplot
Dear R-users, I would have another question about the ggplot() function in the ggplot2 package. All the examples I've read so far in the documentation make use of a single neatly formatted data.frame. However, sometimes, one may be interested in plotting on the same grid information or objects derived from two totally different datasets and customize both displays. I still cannot tell how
2009 Dec 11
1
ggplot: Problem with legend background
Dear R-users, I am preparing graphs for an upcoming article using the different functions of the ggplot2 package and I've been having problems with the legend background. It doesn't seem to scale when the text size is increased. Here's the mandatory reproducible example: library(ggplot2) repFrame <- data.frame(A= 1:10, B= rnorm(1:10), groupNum = rep(c("First group",
2009 Dec 17
2
Sweave Makefile issue
Dear R-specialists, I am trying to create a Makefile that will first convert all my .Rnw files into .tex files and then, that will run the LaTeX compiler to produce a pdf document. This issue has been discussed before. Hence, I've basically adapted a Makefile I found at http://n4.nabble.com/R-Sweave-R-and-complex-latex-projects-td810020.html#a810023 to make it compatible with a Windows
2003 Sep 15
0
LLVM now supports setjmp/longjmp!
Thanks to the hard work of Bill Wendling (wendling at isanbard.org), LLVM now translates setjmp/longjmp calls into the LLVM "exception handling" instructions invoke & unwind. This means that all of the LLVM optimizers are now aware of the extra control flow edges made possible by setjmp & longjmp, so data flow analyses won't make incorrect transformations. A variety of
2009 Jun 01
1
installing sn package
Hi r-users, I want to use the sn package but I got the following message: > install.packages(repos=NULL,pkgs="c:\\Tinn-R\\sn_0.4-12.zip") Warning: package 'sn' is in use and will not be installed updating HTML package descriptions I did tried to do it a few times but it gives the same message.  ________________________________ From:
2011 Dec 06
1
Can't load package 'lars'
Hi, I installed package 'lars' earlier tonight and did not get any sort of error message. ### ** building package indices ... ** testing if installed package can be loaded Loaded lars 0.9-8 * DONE (lars) ### However, when I try to load it, I get ### > library(lars, lib.loc = "~/R/x86_64-redhat-linux-gnu-library/2.11") Error : .onLoad failed in loadNamespace() for
2016 Apr 09
3
How to print the graphs in landscape/portrait orientation
Hi, I made a few graphs by ggplot. The following codes produce a pdf file with graphs in landscape orientation on my Windows PC, while they produce a pdf file with the same graphs, but in portrait orientation: *p2 <- lapply(1:(2*n), function(.x) xyz_outl[.x][[1]]) #a sequence of graphs made by ggplot* *m2 <- marrangeGrob(p2, nrow=3, ncol=2) * *ggsave("xyz.pdf", m2)*
2009 Dec 04
2
[ggplot2] Wind rose orientation
Aloha all, I love using ggplot. It took a while to get used to the grammar of graphics, but it is starting to get easy now that I am thinking in a more structured way. A question. I'm making a wind rose that I'd like to be oriented with due north straight up. I've discovered that the orientation is sensitive to how north is represented. When north is represented as 0,
2009 May 05
0
S4 slot of type connection [Sec=Unclassified]
I am having trouble declaring a slot of type "connection" or "file" in which to store a file connection. I get a warning message when class definition is loaded: In .completeClassSlots(ClassDef, where) : undefined slot classes in definition of "Element": datafileConn(class "file") Can anyone suggest what type I should be using for the slot. Type