Displaying 20 results from an estimated 6000 matches similar to: "matrix merge problem"
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
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!
2009 May 27
2
Object-oriented programming in R
Dear R-users,
I have very recently started learning about object-oriented programming
in R. I am far from being an expert in programming, although I do have
an elementary C++ background.
Please take a look at these lines of code.
> some.data = data.frame(V1 = 1:5, V2 = 6:10) ;
> p.plot = ggplot(data=some.data,aes(x=V1, y=V2)) ;
> class(p.plot) ;
> [1] "ggplot"
My
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
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 Apr 30
1
Overlaying graphs from different datasets with ggplot
Dear R-users,
I recently began using the ggplot2 package and I am still in the process of
getting used to it.
My goal would be to plot on the same grid a number of curves derived from
two distinct datasets. The first dataset (called molten.data) looks like
this :
Column names : Perc, Week, Weight
P10 21 333.3554
P90 21 486.0480
P10 22 452.6347
P90 22 563.8263
P10 23 575.0960
P90
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 Apr 07
1
matrix filtering and reordering
I have two matrixes,
red:
a 123
c 200
d 400
e 650
g 127
f 100
and blue:
a 10
b 20
c 30
d 40
e 50
f 60
g 70
is there any easy way to get the next matrix:
a 10 123
b 20 0
c 30 200
d 40 400
e 50 650
f 60 100
g 70 127
i.e. to add in the third column of blue the [,2] values of red corresponding
to the file with same [x,1] value of blue, adding a cero in the case that
there is no
[x,1]
2007 Nov 22
4
more outrageous plotting
Dear Contributors:
I have the next matrix:
"X" "Y" "Z"
1 2 526
2 5 723
3 10 110
4 7 1110
5 9 34
6 8 778
7 1 614
8 4 876
9 6 249
10 3 14
I want to order the matrix from bigest Z (1110) to lower Z (14).
Then I want to asign a color scale vector from blue ( bigest Z) to
orange
2008 Jan 17
1
Res: vector generation
hi Juan,
It is not so elegant, but work fine. I know that our colleagues can do it on a simple line.
z<-c(526,723,110,1110,34,778,614,249,14)
v1<-NULL
v2<-NULL
for (i in 1:(length(z)-1))
{
for (j in i:length(z))
{
v1<-rbind(v1,z[i])
v2<-rbind(v2,z[j])
}
}
df<-data.frame(cbind(v1=v1,v2=v2))
names(df)<-c("v1","v2")
df$ratio<-df$v1/df$v2
Kind regards,
2007 Jul 05
3
help with vector construction
Hi all,
I want to make a vector with the third column of a matrix, but only for the
2+3n rows of the matrix, with n being an entire number from 0 to a million.
How can I do that in an easy way?
Thanks in advance,
Juan Pablo
[[alternative HTML version deleted]]
2009 Feb 22
2
filtering a simple matrix
Hi all,
I have the next matrix:
a b c
1 2 23
2 3 42
3 0 54
4 5 23
5 0 22
6 7 21
7 1 20
8 9 19
I want to filter the rows with the values of b higher than 1 in a way that
leaves me the next matrix:
a b c
1 2 23
2 3 42
4
2007 Feb 27
4
ordered matrix question
Hi all,
Is there an easy way to generate an object wich will be the same matrix, but
ordered by de cfp value?
The data frame consists of numeric columns:
"Block" "X" "Y" "cfp" "yfp" "ID"
0 524 244 213.41795 7.18482109 1
0 556 270 65.383904 9.568372661 2
0 528 316 40.789474
2011 Oct 20
3
Strange R behavior for product of two sum of integers
Dear gentlemen,
Can you explain me why the following happens (any OS I think, and even
on 64 bits)?
> sum(1000:1205)^2
[1] 51581223225
> sum(1000:1205)*sum(1000:1205)
[1] NA
Warning message:
In sum(1000:1205) * sum(1000:1205) : NAs produced by integer overflow
Best,
Pierre
--
Pierre Lafaye de Micheaux
Adresse courrier:
D?partement de Math?matiques et Statistique
Universit? de
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
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
2008 Jan 24
4
two histograms in the same graph
Dear Contributors:
I have two vectors x and z, and I want to display the histograms of both
vectors in the same graph, x in red bars, z in blue bars.
If you have any clue on how to do that, I will be very glad to hear it!!!!!!
Thanks in advance again,
Juan Pablo Fededa
[[alternative HTML version deleted]]
2008 Jan 17
3
vector generation
Dear Contributors:
I have the next vector:
"Z"
526
723
110
1110
34
778
614
249
14
I want to generate a vector containing the ratios of all the values
versus all the values of the z vector. I mean a vector containing the
values of 526/723, 526/110, and so on, 723/723, 723/110, and so on,
and so on.
Is this doable in a simple way??
Thanks in advance again,
Juan Pablo Fededa
2010 Oct 11
2
compare histograms
Hello
How to compare two statistical histograms? How i can know if these histograms are equivalent or not??
Regards
[[alternative HTML version deleted]]
2009 Apr 23
1
Loess over split data
Dear R users,
I am having trouble devising an efficient way to run a loess() function
on all columns of a data.frame (with the x factor remaining the same for
all columns) and I was hoping that someone here could help me fix my
code so that I won't have to resort to using a for loop.
(You'll find the upcoming lines of code in a single block near the end
of the message.)
Here's a