Displaying 20 results from an estimated 20000 matches similar to: "How to label a "vector""
2010 Feb 25
2
Rearranging entries in a matrix
I have a matrix, called data. I used the code below to rearrange the data such that the first column remains the same, but the y value falls under either columns 2, 3 or 4, depending on the value of z. If z=1 for example, then the value of y will fall under column 2, if z=2, the value of y falls under column 3, and so on. 
data
  x  y z
[1,] 50 13 1
[2,] 14  8 2
[3,]  3  7 3
[4,]  4 16 1
[5,]  6 
2009 Oct 07
1
Save plot to text file
Dear all:I am sorry if I have missed a solution posted earlier.
My collaborator (sitting in a different time zone  and not on R) wants to
re-plot the charts that I have obtained after some complex processing. There
are thirty charts in all, of different types, and some are multi-plots
(plot(new=T)).
Is there a way to 'save' or 'dump just the x-y coordinates to a text/ASCII
file, like
2007 Nov 14
1
Changing the text in the strips of lattice plots and y axis
Dear R-helpers,
   I am sorry for asking something I know has been
asked before, I have tried different combinations in
the strip function without success...
    I am using version 2.5.1 and work on a PC.
   I have  barcharts generated from the following
formula:
barchart(y1+y2+y3~x | g)
I need to change the names of the variables y1,y2 or
y3 that currently appear in the strips, I have two
2011 Aug 15
1
update() ignores object
Hi all,
I'm extracting the name of the term in a regression model that
dropterm specifies as the least significant one, and I'm assigning
this name to an object. However, when I use update(), it ignores this
object. Is there a way I can make it not ignore it? A reproducible
example is below:
> lm(x1~1+y1*y2+y3+y4,data=anscombe)->my.lm
>
2005 Jan 21
2
Selecting a subplot of pairs
Hello,
I'm trying to plot a set of 3 dependant variables (y) against 4 
predictors (x) in a matrix-like plot, sharing x- an y-axis for all the 
plot on the same column/line :
y1/x1   y1/x2   y1/x3   y1/x4
y2/x1   y2/x2   y2/x3   y2/x4
y3/x1   y3/x2   y3/x3   y3/x4
In fact, this plot is a rectangular selection of the result of pairs(), 
limited to the relations between x's and y's
2007 Aug 07
1
Error in as.double.default(x) : (list) object cannot be coerced to 'double'
Dear experts,
I have in all 14 matrices which stands for gene expression divergence and 14 matrices which stands for gene sequence divergence. I have tried joining them by using the concatanation function giving
SequenceDivergence <- c(X1,X2,X3,X4,X5,X6,X7,X8,X9,X10,X11,X12,X13,X14)
ExpressionDivergence <- c(Y1,Y2,Y3,Y4,Y5,Y6,Y7,Y8,Y9,Y10,Y11,Y12,Y13,Y14) 
where X1,X2..X14 are the
2011 Mar 25
4
read.xls -> rotate data.frame
Hi to all,
how could I  to rotate automatically a data sheet which was imported by 
read.xls?
      x1 x2 x3 .... xn
y1 1   4  7   ...  xn/y1
y2 2   5  8   .... xn/y2
y3 3   6  9    ....xn/y2
yn ... ... ...         Xn/Yn
to
       y1 y2  y3   ....  yn
x1  1  2    3     ..... Yn/x1
x2  4  5    6     ....  Yn/x2
x3  7  8   9      ....  Yn/x2
xn  ...   ...  ...   .....  Yn/xn
Kind regards Knut
2005 Apr 04
1
custom loss function + nonlinear models
Hi all;
I'm trying to fit a reparameterization of the
assymptotic regression model as that shown in
Ratkowsky (1990) page 96. 
Y~y1+(((y2-y1)*(1-((y2-y3)/(y3-y1))^(2*(X-x1)/(x2-x1))))/(1-((y2-y3)/(y3-y1))^2))
where y1,y2,y3 are expected-values for X=x1, X=x2, and
X=average(x1,x2), respectively.
I tried first with Statistica v7 by LS and
Gauss-Newton algorithm without success (no
2010 Jan 28
1
question about reshape
Hello everyone,
 I have a bit of a problem with reshape function in R.
 I have simulated some normal data, which I have saved in 4 vectors.
 y.1,y.2,y.3,y.4 which I combined a dataset:
dataset<cbind(y1,y2,y3,y4). I have also generated some subject id number,
and denoted that by subject.
 So, my dataset looks like this:
    subject       y.1        y.2       y.3       y.4
 [1,]       1 20.302707
2010 Oct 21
1
All other variables in upper scope arg for stepAIC
Hi - I am trying to substitute for "the_other_y" in the code below.  I want
y2 and y3 to be there when i is 1, y1 and y3 to be there when i is 2 and y1
and y2 to be there when i is 3.  I'm sure it's to do with what format the
data should be in and I've tried alldata[,-i], but it fits all the columns
of alldata except i rather than each column one at a time.  I've tried
2008 Dec 29
4
Merge or combine data frames with missing columns
Hi R-experts,
suppose I have a list with containing data frame elements:
[[1]]
(Intercept)          y1          y2          y3          y4 
 -6.64              0.761      0.383      0.775      0.163
 
[[2]]
(Intercept)          y2          y3          
-3.858             0.854      0.834     
Now I want to put them into ONE dataframe like this:
               (Intercept)           y1         
2011 Jan 19
2
Reshape
Hi - I'm up against a complicated reshape problem.  I have data of the form
X1,Y1,hr1,hr2,hr3
X1,Y2,hr1,hr2,hr3
X1,Y3,hr1,hr2,hr3
X2,Y1,hr1,hr2,hr3
X2,Y2,hr1,hr2,hr3
X2,Y3,hr1,hr2,hr3
where X and Y are factors and the hr(1,2,3) are values.  I need it as
    ,X1, X2
Y1,hr1,hr1
Y1,hr2,hr2
Y1,hr3,hr3
Y2,hr1,hr1
Y2,hr2,hr2
Y2,hr3,hr3
..,
Any hints? I've been at it for hours.
p
-- 
View
2008 Aug 13
1
summary.manova rank deficiency error + data
Dear R-users;
Previously I posted a question about the problem of rank deficiency in
summary.manova. As somebody suggested, I'm attaching a small part of
the data set.
#***************************************************
"test" <-
structure(.Data = list(structure(.Data = c(rep(1,3),rep(2,18),rep(3,10)),
levels = c("1", "2", "3"),
class =
2005 Feb 14
1
corrupt data frame: columns will be truncated or padded with NAs in: format.data.frame(x, digits = digits)
Hello!
I posted on saturday mail with the same subject on r-help seeking
for help in my work, but now I realized that this list is more 
appropriate for this. I think I found I bug. Bellow are comments
and reproducible examples:
# Create a data frame
(tmp <- data.frame(y1=1:4, f1=factor(c("A", "B", "C", "D"))))
  y1 f1
1  1  A
2  2  B
3  3  C
4  4  D
#
2005 Feb 14
1
corrupt data frame: columns will be truncated or padded with NAs in: format.data.frame(x, digits = digits)
Hello!
I posted on saturday mail with the same subject on r-help seeking
for help in my work, but now I realized that this list is more 
appropriate for this. I think I found I bug. Bellow are comments
and reproducible examples:
# Create a data frame
(tmp <- data.frame(y1=1:4, f1=factor(c("A", "B", "C", "D"))))
  y1 f1
1  1  A
2  2  B
3  3  C
4  4  D
#
2010 Jan 05
1
Multivariate Poisson GLM??
Dear R Users,
I'm working on a problem where I have a multivariate response vector of
counts and a continuous predictor.
 I've thought about doing this the same way you would do a Multvariate
regression model with normally distributed data, but since these data are
counts, they are probably better modeled with a Poisson distribution.
For example
y1<-rpois(100,3.5)
y2<-rpois(100,1.5)
2007 Dec 06
2
How can I plot this graph
Hi,
I am having trouble plotting the graph I need given the follow kind of data
> xxx <- data.frame(
               "x"=c(1,2,3,4,5),
               "y1"=c(2,4,3,5,6),
               "y2"=c(3,4,6,3,1),
               "y3"=c(1,3,5,7,3),
               "z1"=c(1,NA,3,5,NA),
               "z2"=c(2,NA,4,6,NA) )
> xxx
  x y1 y2 y3
2010 Feb 28
4
Reducing a matrix
I wish to rearrange the matrix, df, such that all there are not repeated x values. Particularly, for each value of x that is reated, the corresponded y value should fall under the appropriate column.  For example, the x value 3 appears 4 times under the different columns of y, i.e. y1,y2,y3,y4. The output should be such that for the lone value of 3 selected for x, the corresponding row entries
2007 Nov 20
1
Vectorization/Speed Problem
Hi,
I cannot find a 'vectorized' solution to this 'for loop' kind of problem.
Do you see a vectorized, fast-running solution?
Objective:
Take the value of X at each timepoint and calculate the corresponding value
of Y.  Leading 0's and all 1's for X are assigned to Y; otherwise Y is
incremented by the number of 0's adjacent to the last 1.  The frequency and
2010 Jul 12
3
Continuing on with a loop when there's a failure
Hi R sages,
Here is my latest problem. Consider the following toy example:
x <- read.table(textConnection("y1 y2 y3 x1 x2
indv.1 bagels donuts bagels 4 6
indv.2 donuts donuts donuts 5 1
indv.3 donuts donuts donuts 1 10
indv.4 donuts donuts donuts 10 9
indv.5 bagels donuts bagels 0 2
indv.6 bagels donuts bagels 2 9
indv.7 bagels donuts bagels 8 5
indv.8 bagels donuts bagels 4 1
indv.9