Displaying 20 results from an estimated 1000 matches similar to: "java R interface"
2007 May 14
2
creating a "list of 3 dataframes" from a "list of 2 dataframes" and a dataframe?
#I wish to create a "list of three dataframes" ("results2") from a "list of two dataframes" (temp) and a dataframe ("c")?
#Please advise.
a <- data.frame(x=c(1,2,3),y=c(5,7,9))
b <- data.frame(x=c(2,4,7,9),y=c(2,3,5,4))
c <- data.frame(x=c(22,34,7,9),y=c(52,63,5,4))
results1 <- list(a,b,c) #what I want
#but this is how I need to get there
2007 Nov 20
2
adding an image to a plot
Hi, I'm writing code to generate a plot, in which I draw a series of
rectangles. So my code is of the form
plot.new()
plot.window( ... )
draw rectangle
draw rectangle
...
Is there a way for me to insert a PNG or PDF graphic at a specific
position in the plot (ideally in plot coordinates)? I realize that
this might probably be better done in a separate image editor, but if
it could
2003 Nov 10
10
shuffling a vector
Hi,
I'me trying to write a function that will shuffle a vector. At the
moment I'm baically making a vector of randomized indices and then
making a new vector from the original one using these random indices.
However, is there an alternative (more elegant) method to do this? I
tried help.search('shuffle') but it does'nt return anything relevant.
Thanks,
2007 Aug 13
4
vertically oriented color key in heatmaps
Hi, I have some data which I was plotting using image(). I wanted to
add a vertical color key to the plot and I found that heatmap.2 in
gplots does let me add a color key. However, I was thinking of a
vertical bar with the color range rather than the style that gplots
provides.
Is there any package (or code snippet) that would let me add a
vertical color key to an image() or heatmap
2003 Nov 10
5
attaching data to any object
Hi,
is the following possible - in a given session I make a lot of objects
and save when exiting. Usually I note down seperately what each object
is about. Is it possible to attach data to any object which would
essentially be a short note explaining the meaning of it?
Thanks,
-------------------------------------------------------------------
Rajarshi Guha <rxg218 at psu.edu>
2005 May 26
5
a more elegant approach to getting the majority level
Hi, I have a factor and I would like to find the most frequent level.
I think my current approach is a bit long winded and I was wondering if
there was a more elegant way to do it:
x <- factor(sample(1:0, 5,replace=TRUE))
levels(x)[ which( as.logical((table(x) == max(table(x)))) == TRUE ) ]
(The length of x will always be an odd number, so I wont get a tie in
max())
Thanks,
2004 Feb 06
3
a grep/regexpr problem
Hi,
I'm trying to parse lines of the form:
dan001.hin (0): fingerprint={256, 411, 426, 947, 973, 976}
What I need is the sequence of number between {}. I'm using grep as
match <- grep("{([0-9,\s]*)}",s,perl=T,value=T)
where s is a character vector.
But all I get is the whole string s. I tried using regexpr in an attempt
to get just the sequence I wanted:
match <-
2007 Aug 09
1
S4 based package giving strange error at install time, but not at check time
Hi, I have a S4 based package package that was loading fine on R
2.5.0 on both OS X and
Linux. I was checking the package against 2.5.1 and doing R CMD check
does not give any warnings. So I next built the package and installed
it. Though the package installed fine I noticed the following message:
Loading required package: methods
Error in loadNamespace(package, c(which.lib.loc, lib.loc),
2003 Oct 02
4
using a string as the formula in rlm
Hi,
I am trying to build a series of rlm models. I have my data frame and
the models will be built using various coulmns of the data frame.
Thus a series of models would be
m1 <- rlm(V1 ~ V2 + V3 + V4, data)
m2 <- rlm(V1 ~ V2 + V5 + V7, data)
m3 <- rlm(V1 ~ V2 + V8 + V9, data)
I would like to automate this. Is it possible to use a string in place
of the formula?
I tried doing:
fmla
2006 Nov 29
1
An example of using rJava
I have received a few private emails asking for some simple
demonstration of calling Java code from R using the rJava package
(which can be installed directly inside R). Here is one example for
convolving two vectors (an example in the R manual about linking C with
R).
First write a Java program
public class my_convolve
{
public static double[] convolve(double[] a, double[] b)
2007 Apr 24
2
negative number to positive number
Hello all,
I know this is a pretty easy question but I can't find it in S poetry or
R help.
How can I make a negative number positive. Such as
-5 to be +5
I tried +(-5), but that didn't work.
So no, I don't mean taking a -5^2 just to get a positive number.
This is in a function so it's not just -5 it's x. :)
Thanks,
Paul
--
Research Technician
Mass Spectrometry
o The
2007 Apr 25
1
Scripting graph generation
Hi,
I'm looking to automate the generation of some graphs in R. I can't seem to
figure out how to script R, and change the output device of hist() or plot()
to create a .gif or .png file. This seems like something that is probably
really simple, and I've just overlooked the call do do it. Can anyone point
me in the right direction, or maybe send a sample script?
thanks,
--Mike
2003 Dec 03
3
checking for identical columns in a mxn matrix
Hi,
I have a rectangular matrix and I need to check whether any columns
are identical or not. Currently I'm looping over the columns and
checking each column with all the others with identical().
However, as experience has shown me, getting rid of loops is a good idea
:) Would anybody have any suggestions as to how I could do this job more
efficiently.
(It would be nice to know which
2004 May 20
2
column sorting a matrix with indices returned
Hi,
I'm trying to translate some Matlab code to R and I'm trying to
implement the behavior of Matlab's sort() which when applied to a matrix
will sort the columns returning the column sorted matrix as well as a
matrix of permuted indices.
Doing:
> x <- matrix(c(3,4,2,6,3,4,8,7,5), nr=3)
> x
[,1] [,2] [,3]
[1,] 3 6 8
[2,] 4 3 7
[3,] 2 4 5
2007 Jun 24
1
JRI and Axis Web Service
Hi all,
It is my first time to use the R-help mailing list and doesn't have too
much R acknowledge. The reason that I am writing this email is looking
for helps of using JRI in Java Axis Web Service. Well, I am not quite
sure if this is the right place to ask this kind of questions, but I
can't find the JRI mailing list. So please give me some hints if this is
not the right place to
2003 Sep 03
3
plotting a distribution curves
Hi,
is there a way to plot distribution curves (say normal or chi sq etc)
from within R?
For example I looked up the *chisq family of functions but I'm not sure
as to how I would use them to generate a plot of the chi sq distribution
(for arbitrary d.o.f).
Thanks,
-------------------------------------------------------------------
Rajarshi Guha <rajarshi at presidency.com>
2003 Nov 18
2
sampling without repetition
Hi,
I'm trying to write a function that will divide a given range of
numbers into 3 sets using sample(), without repetition. Currently I'm
trying this approach:
r <- 1:10
s1 <- sample(r,size=3)
Next, I want to remove the selected elements from r and sample() from
the remainder.
r <- r[ -(r=s1) ]
s2 <- sample(r,size=3)
When I go to remove the elements contained in s2 from
2004 Mar 02
3
using object reference
Hi,
I have read the previous thread on using references to objects in a
function but the solution suggested does'nt seem to be working.
basically I have an object x which has an attribute a containing some
text. I would like to pass x to a function which will change the
attribute a with some new text and have the change visible when the
function exits.
something like
attr(x,'a')
2007 Apr 27
2
Integrating R-programs into larger systems
Hi experts!
Have anybody experience in including an R-program
as part of a larger system? In Matlab there is a toolbox
that converts a m-script into C-code.
One application in mind is that I do the model building in R,
for estimating the risk for cancer based on clinical measurements.
When the model is ready, a small R-program can simulate
the model to estimate the risk for a new patient. The
2004 Mar 27
3
a question about scoping functions
Hi,
I've written some helper functions which are used by another function
(called func()). When func() is sourced I dont want the helper function
to be seen in the global namespace (as shown by ls()).
Currently what I have done is:
func <- function() {
helper1 <- function() {
...
}
helper2 <- function() {
...
}
# some code
}
Is there anyway to take the functions