Displaying 20 results from an estimated 40000 matches similar to: "Plot matrix"
2008 Jun 06
2
Plot matrix as many lines
Suppose that I have a matrix like:
m <- rbind(c(1,2,3,4), c(2,3,2,1))
Is there any way to efficiently plot the _lines_ as if
I was doing:
plot(m[1,], type="l")
points(m[2,], type="l", col="red")
(of course, in the "real world" there much more than
just 2 lines and 4 columns...)
Alberto Monteiro
2008 Sep 05
1
Plot by column
Dear list,
I have the following matrix. How can I make the following plot?
1. The x-axis has index 1:7, and the first column is plotted against index 1, second against 2, and so on.
2. I want the points from the left upper conner including the antidiagonal to be plotted with col=2, and the rest with col=3
[,1] [,2] [,3] [,4] [,5] [,6] [,7]
[1,] 0.589 0.857 0.923 0.944 0.954 0.963
2007 Oct 22
3
median value dataframe coming from multiple dataframes
Hi all,
I am not a skillful R programmer and has I am handling with large dataframes (about 30000 x 300) I am in need of an efficient function.
I have 4 dataframes with the same dimension. I need to generate other dataframe with the some dimension than the others where in each position it has the median value of the 4 values in the same position coming from the 4 dataframes.
Grateful by your
2007 Nov 07
2
Trouble in creating a list
I want to create a list based on the information from a data.frame,
Model. So I tried the following:
MyList <- list(colnames(Model)[2] = levels(Model$(colnames(Model)[2])))
but it failed with an error:
Error: unexpected '=' in "list(colnames(Model)[2] ="
I have the following problems with this command line:
(1) I wanted to use colnames(Model)[2] as a tag for the list:
2008 Apr 14
3
how to add different type of lines (short dash, long dash) into current plot)
Dear
I try to add three different lines (solid, short dash, long dash) in to current barplot. I saw there are types of lines ("p","b", ect). However, they are not what I request. Has nayone have this experience?
Many Thanks!
Xin
[[alternative HTML version deleted]]
2010 Sep 03
5
how to get row name of matrix when result is a vector
Hi,
the R code:
a <- matrix(c(1,5,4,3,7,10,34,4,3,8,6,5,12,17,45,3,2,45,46,47,3,4,22,12,21),
nrow=5)
rownames(a) <- c("a","b","c","d","e")
a
a[which(a[,3] < 8), ]
a[which(a[,3] < 6), ]
produces the following output:
> a
[,1] [,2] [,3] [,4] [,5]
a 1 10 6 3 3
b 5 34 5 2 4
c 4 4 12 45 22
d
2008 Mar 24
6
vlookup in R
Hi,
Is there are function similar to excel vlookup in R. Please let me know.
Thanks,
Sachin
____________________________________________________________________________________
[[alternative HTML version deleted]]
2010 Aug 21
4
basic hist() question
Hi list
I loaded the content of a file dureetasks.txt to variable a. This file
contains an interger per line.
when I print a vector, it displays correctly.
however, when I try to print the histogram, I get this error message
> a=read.table("dureetasks.txt")
> hist(a)
Error in hist.default(a) : 'x' must be numeric
Can you help please?
regards
--
PhD candidate in
2008 Mar 04
3
creating a matrix subset based on a threshold cutoff
Hi,
I have a table of x rows and y columns. The table is huge and so i'd like
to create a subset of the data containing rows where any of the y values are
below a threshold, say 1e-4. Is there a simple way of doing this in R?
thanks
Rich
2008 May 14
2
Dividing Two Dataframes
Hi,
I have two dataframes one with 144 rows and 160 columns (SDF1) and one with
12 rows and 160 columns (SDF2).
Now I'm trying to divide rows 1:12 with SDF2, rows 13:24 with SDF2, rows
25:36 with SDF 2, .
In S-Plus the following code works fine:
DFS = SDF1[1:144,1:60] / as.vector(SDF2[1:12,1:160])
but in R when I try to implement the formula I get the following error:
"/
2008 Mar 19
4
plot with diffrent colour and plotting symbols
Dear mailing list members,
I am a new R user, I would like to plot the follewing data
var1 <- c(1,2,1,1,2,1,2,1,2,2)
var2 <- round(rgamma(10,2,1)/0.1)*0.1
var3 <- c(0,1,0,1,0,0,0,0,1,0)
var4 <- c(1,2,2,2,1,1,1,1,1,1)
Var <- data.frame(var1,var2,var3,var4)
Var <- Var[sort(Var$var1),]
tt <- Var$var1+((runif(length(Var$var1))/6)-(0.5/6))
labelname <- c("time 1",
2007 Feb 23
4
How to plot two graphs on one single plot?
Hi,
I am trying to plot two distribution graph on one plot. But I dont know
how. I set them to the same x, y limit, even same x, y labels.
Code:
x1=rnorm(25, mean=0, sd=1)
y1=dnorm(x1, mean=0, sd=1)
x2=rnorm(25, mean=0, sd=1)
y2=dnorm(x2, mean=0, sd=1)
plot(x1, y1, type='p', xlim=range(x1,x2), ylim=range(y1, y2), xlab='x',
ylab='y')
plot(x2, y2, type='p',
2008 Apr 12
1
lm() of one matrix against another
Hello R list,
I have two matrices of identical dimensions, and I want to fit a
straight line for each pair of columns and plot the resulting lines.
I got it to work with a for loop, but there must be a better way,
> n<-5
> N<-10
>
> data.x<-matrix(1:(n*N),ncol=n)
> data.y<-matrix(1:(n*N) + rnorm(n*N,sd=1),ncol=n)
>
>
2011 Jan 14
2
selecting elements in vector
Hi everybody,
I have the following problem. I have a vector containing character elements,
such as:
list = c("aa","bb","cc","dd","ee")
I want to create an index which identifies the elements that are different
from, e.g. "aa" and "bb".
When I do the following:
jj = list!="aa" & list!="bb"
> jj
2009 Jul 08
5
R regular expression to extract words with the query string.
Hi,
Is there a way in R to get the string which matches the expression, where
the expression is a substring of the parent string.
Lets say, I have $i <- "transcript:ENST0000112334 pid:ENSP000012345"
What I need is the string "pid:ENSP000012345" from $i using the query
"ENSP".
Appreciate your comments.
Praveen Surendran
School of Medicine and
2010 Oct 26
3
stripping #s in a text file prior to reading into table or dataframe
I'm importing a lot of text tables of data (from Latent Gold) that includes
hashes in some of the column names ("Cluster#1", "Cluster#2", etc.). Is
there an easy way to strip the offending hashes out before pushing the text
into a table or data frame? I thought I'd use gsub, e.g., but can't figure
out how to read in a text file without reading it into a table or
2007 Apr 24
4
from R to html
hello,
If I wanna export data.frame from R to html have you got some ideas to do this?
___________________________________________________________________________
[[alternative HTML version deleted]]
2007 May 04
3
listing R packages in our system
Hi,
I like to know the simple way to list the R package names in our linux
system.
Thanks
Ying
[[alternative HTML version deleted]]
2007 Jun 25
3
fractional calculations
Hi All,
is there a function in R that allows me to work with fractions without
transforming them to floats (or whatever) in between?
Something that would calculate something like:
(1/2 + 1/8) * 1/2 = 5/16
without ever transforming to 0.5 and 0.125?
Best,
Federico
--
Federico C. F. Calboli
Department of Epidemiology and Public Health
Imperial College, St Mary's Campus
Norfolk Place,
2010 May 26
5
(no subject)
Dear group,
Here is my data frame:
> dput(u)
structure(list(DESCRIPTION = structure(c(2L, 5L, 6L, 7L, 9L,
11L, 12L, 15L, 14L, 16L, 1L, 10L, 3L, 4L, 13L, 8L, 17L), .Label = c("COFFEE
C Jul/10",
"COPPER May/10", "CORN Jul/10", "CORN May/10", "COTTON NO.2 Jul/10",
"CRUDE OIL miNY May/10", "GOLD Jun/10", "HENRY HUB