Displaying 20 results from an estimated 4000 matches similar to: "select from matrix"
2004 Apr 11
3
pcauchy precision (PR#6756)
Full_Name: Morten Welinder
Version: snapshot
OS:
Submission from: (NULL) (65.213.85.129)
Two things are wrong.
1. There is nan test outside IEEE_754.
2. The meat part of the function should really be something like...
if (!lower_tail)
x = -x;
if (fabs (x) > 1) {
double temp = atan (1 / x) / M_PI;
return (x > 0) ? R_D_Clog (temp) : R_D_val (-temp);
} else
2006 Sep 06
3
plot axises on both sides of a graph
Usually the y-axis is shown on the left-hand-side of a graph, is it possible
to artifically creat one more y-axis on the right-hand-side in R? What is
the main reference? Thank you in advance.
[[alternative HTML version deleted]]
2008 Nov 24
3
select a subset
I have the complete data like
id time censor
1 10 0
1 20 0
1 30 0
2 10 0
2 20 1
2 30 0
2 40 0
3 10 0
3 20 0
3 30 1
....
for id 1, i want to select the last row since all censor indicator is 0; for
id 2, i want to select the row where censor ==1; for id 3, i also want to
select the row where censor==1. So if there is a 1 for censor, then I want
to select such a row, otherwise I want to select the
2010 Apr 22
4
how to select the first observation only?
Dear r-helpers,
I have a very simple question. Suppose my data is like
id=c(rep(1,2),rep(2,2))
b=c(2,3,4,5)
m=cbind(id,b)
> m
id b
[1,] 1 2
[2,] 1 3
[3,] 2 4
[4,] 2 5
I wish to select the first observation for each id. That is, I want to
quickly select two rows:
id b
1 2
2 4
only. how should i do this?
[[alternative HTML version deleted]]
2006 Sep 06
4
histogram in the background?
I intend to draw a plot of y against x. In the background of this graph I
wish to creat a histogram of the horizontal variable x. Does any expert know
how to produce such a plot?
[[alternative HTML version deleted]]
2011 Jul 20
3
select element from each row of the matrix
I have a 5 column matrix like
12 10 8 6 3
10 9 8 7 5
14 NA 4 NA NA NA
15 NA 10 NA 5
...
I want to select the position of the first entry for each row <=5
for example, for the first row, I want to select the last element and return
its position as 5;
for th e third row, I want to select the third element and return its
position as 3;
similarly for the 4th row, I want to select the fifth
2009 Jan 18
2
select observations from longitudinal data set
I have the following longitudinal data:
id time y
1 1 10
1 2 12
1 3 15
1 6 18
2 1 8
2 3 9
2 4 11
2 5 12
3 1 8
3 4 16
4 1 9
4 5 13
5 1 7
5 2 9
5 6 11
....
I want to select the observations at time 4. if the observation at time 4 is
missing, then i want to slect the observation at time 3. if the observation
at time 3 is also missing, then i want to select observation at time 5.
otherwise i will
2009 Jan 02
7
the first and last observation for each subject
I have the following data
ID x y time
1 10 20 0
1 10 30 1
1 10 40 2
2 12 23 0
2 12 25 1
2 12 28 2
2 12 38 3
3 5 10 0
3 5 15 2
.....
x is time invariant, ID is the subject id number, y is changing over time.
I want to find out the difference between the first and last observed y
value for each subject and get a table like
ID x y
1 10 20
2 12 15
3 5 5
......
Is there any easy way to generate
2007 May 05
3
Tell me why my Shoutcase handler sucks!
So, I want to build the greatest online radio ever! (for my, currently
crappy, faderwave.net radio station. Right now, I''m running Icecast
straight up. The only problem is that managing different DJs and
keeping them off the air when they aren''t supposed to be there is a
pain. There also is not one single management package that does
everything. My current system is a hacked
2007 Jul 14
1
change default alphabetic order for bwplot
when producing boxplot from bwplot, I have five groups: Nitrogen, Duration,
Pressure, A, Z. I wish the graphical display is according to the original
order. But the R-function bwplot seems to automatically adjust the groups
according to the alphabetic oder and thus creat a graph for A, Duration,
Nitrogen, Pressure and Z. How can I specify the original order in bwplot?
This also happens to the
2007 Jun 10
3
find position
find the position of the first value who equals certain number in a vector:
Say a=c(0,0,0,0,0.2, 0.2, 0.4,0.4,0.5)
i wish to return the index value in a for which the value in the vector is
equal to 0.4 for the first time. in this case, it is 7.
[[alternative HTML version deleted]]
2007 Sep 13
4
how to plot shaded area under a curve?
say, I am plotting
x=seq(0,5,len=100)
y=-(x-5)^2
plot(x,y)
how can I put some color or verticle lines below the plotted curve?
[[alternative HTML version deleted]]
2007 Jan 27
3
how to handle a longitudinal data
i have a data set with repeated measures on same people, structure like
below:
id x1 x2 ...
001 10 20 ...
001 8 45 ...
001 4 2 ...
002 ....
002 ...
002 ....
002 ....
003 ....
.......
what is the easist way to show how many observations for each subject id?
[[alternative HTML version deleted]]
2007 Oct 01
4
how to plot a graph with different pch
I am trying to plot a graph but the points on the graph should be
different symbols and colors. It should represent what is in the legend.
I tried using the points command but this does not work. Is there
another command in R that would allow me to use different symbols and
colors for the points?
Thank you kindly.
data(mtcars)
plot(mtcars$wt,mtcars$mpg,xlab= "Weight(lbs/1000)",
2013 Jul 04
2
how to choose dates data?
i have converted my data into date format like below:
> day=as.Date(originaldate,"%m/%d/%Y")
> day[1:5]
[1] "2008-04-12" "2011-07-02" "2011-09-02" "2008-04-12" "2008-04-12"
I wish to select only those observations from 2007 to 2009, how can I
select from this list?
[[alternative HTML version deleted]]
2007 Oct 21
2
finding paired values from common subjects -- vector operation?
I have two vectors for values collected from a group of subjects, say
a=c(100,200,150,120,140,180)
b=c(200,300,420,130)
I also have two vectors which indicate the corresponding subjects for a and
b, say
for a, the subjects are
suba=c(1,2,3,4,5,6)
for b, the subjects are
subb=c(1,3,5,6)
Then, I want to find out the paired values from a and b, such as (100, 200)
(from subject 1), (150,300)
2007 Dec 19
3
plot cummulative sum from calendar time
I have the following list of observations of calendar time:
[1] 03-Nov-1997 09-Oct-1991 27-Aug-1992 01-Jul-1994 19-Jan-1990 12-Nov-1993
[7] 08-Oct-1993 10-Nov-1982 08-Dec-1986 23-Dec-1987 02-Aug-1995 20-Oct-1998
[13] 29-Apr-1991 16-Mar-1994 20-May-1991 28-Dec-1987 14-Jul-1999 27-Nov-1998
[19] 09-Sep-1999 26-Aug-1999 20-Jun-1997 05-May-1995 26-Mar-1998 15-Aug-1994
[25] 24-Jun-1996 02-Oct-1996
2007 Jul 27
3
Is mechanize thread safe?
Hello all,
I was just wondering if anybody knew whether mechanize is supposed to
be thread-safe or not? I didn''t really find any information about it
anywhere. I''ve been getting a strange error in protocol.rb when I run
a script that uses mechanize in a multi threaded fashion, but not with
a single thread.
I''m trying to write a spider that does multiple gets in
2009 Sep 02
2
Howto fit normal curve into histogram using GGPLOT2
Currently, I am doing it this way.
x <- mtcars$mpg
h<-hist(x, breaks=10, col="red", xlab="Miles Per Gallon",
main="Histogram with Normal Curve")
xfit<-seq(min(x),max(x),length=40)
yfit<-dnorm(xfit,mean=mean(x),sd=sd(x))
yfit <- yfit*diff(h$mids[1:2])*length(x)
lines(xfit, yfit, col="blue", lwd=2)
But since, ggplot2 has more appealing
2009 Mar 29
2
select observations from longitudinal data
Suppose I have a long format for a longitudinal data
id time x
1 1 10
1 2 11
1 3 23
1 4 23
2 2 12
2 3 13
2 4 14
3 1 11
3 3 15
3 4 18
3 5 21
4 2 22
4 3 27
4 6 29
I want to select the x values for each ID when time is equal to 3. When that
observation is not observed, then I want to replace it with the obervation
at time equal to 4. otherwise just use NA.
How can I implement this with a quick