Displaying 20 results from an estimated 20000 matches similar to: "R: deleting rows"
2005 Mar 04
11
R: simulation
hi all
a simple question
i want to run simulations in r. i however want the experiments to be
repeated at a later time with exactly the same numbers by other users.
can i set the random number seed for rnorm in some way?
e.g. is there some arguement that goes with rnorm?
please supply an example
regards
Allan
2004 Sep 29
3
R: string connections
hi all
i have a simple question:
lets assume that i can enter a variable (a) equal to some value, say
100. obviously a could be any value. i would like to create a plot with
a main heading as
hi all
"some writing" + a
how would own create a string by combining a string with a numeric
variable?
hope the question is not too confusing.
e.g. say a=5  then i want something like 
2005 Apr 11
4
R: function code
HI
sorry to be a nuisance to all!!!
how can i see the code of a particular function?
e.g. nnet just as an example
2007 May 20
2
Number of NA's in every second column
Hi R-users,
How do I calculate a number of NA's in a row of every second column in my
data frame?
As a starting point:
dfr <- data.frame(sapply(x, function(x) sample(0:x, 6, replace = TRUE)))
dfr[dfr==0] <- NA
So, I would like to count the number of NA in row one, two, three etc. of
columns X1, X3, X5 etc.
Thanks in advance
Lauri
	[[alternative HTML version deleted]]
2005 Feb 24
4
r: functions
hi all
i have a function that uses two inputs, say xdata and ydata. An example
is the following,
simple1<-function(xdata,ydata)
{
	ofit<-lm(ydata~xdata)
	list(ofit)
}
say i use arbitray number for xdata and ydata such that
D = 
x1	x2	y
1	1	10
2	6	6
3	10	7
x<-D[,1:2]
and 
y<-D[,3]
if one uses these inputs and rund the program we get the following:
>simple(xdata=x,ydata=y)
2010 Nov 30
1
StructTS with 2 seasons
Dear All, 
I am trying to fit a structural time series model using the StructTS
function (package stats) with only 2 seasons (summer and winter). More
than 2 seasons work fine but with 2 seasons I get this error:
> fit <- StructTS(y.ts, type="BSM")
Error in T[cbind(ind + 1L, ind)] <- 1 : subscript out of bounds
I have looked at Prof. Ripley's 2002 RNews article but cannot
2006 Aug 29
3
Substring and strsplit
Dear R People:
I am trying to split a character vector into a set of individual
letters:
Ideal:
x3 <- c("dog")
"d" "o" "g"
I tried the following:
> strsplit(x3)
Error in strsplit(x3) : argument "split" is missing, with no default
> strsplit(x3,1)
[[1]]
[1] "dog"
I know that this is incredibly simple, but what am I doing
2005 Jul 29
5
R: graphics devices
a simple question
how does one produce plots on two different graphics devices?
/
allan
2005 Nov 23
2
vector of permutated products
Given an x-vector with, say, 3 elements, I would like to compute the 
following vector of permutated products
(1-x1)*(1-x2)*(1-x3)
(1-x1)*(1-x2)*x3
(1-x1)*x2*(1-x3)
x1*(1-x2)*(1-x3)
(1-x1)*x2*x3
x1*(1-x2)*x3
x1*x2*(1-x3)
x1*x2*x3
Now, I already have the correctly sorted matrix of permutations! So, the 
input looks something like:
#input
x<-c(0.3,0.1,0.2)
Nx<-length(x)
Ncomb<-2^Nx
2007 Nov 19
4
sequence of vectors
Dear All,
   
  I wonder if there is any R function to generate a sequence of vectors from existing ones. For example:
  x 1<- c(1,2,3)
  x2 <- c(4,5)
  x3 <- c(6,7,8)
   
  The desired output is a list of all 3*2*3 = 18 possible combinations of elements of x1,x2 and x3. One element for example is (1,4,6).
   
  Many thanks in advance,
   
  Bernard
   
   
             
2005 Mar 23
1
more classes to one class in one dataset
I have a big database which more classes in class variable. I want to
make each class to one dataset, for example:
x1 x2 x3 x4  class
a  b  a  c  c    M1
c  b  b  c  c    M4
c  c  a  c  c    M2
c  a  c  a  a    M2
c  c  a  a  a    M1
c  a  b  c  a    M3
c  c  a  b  c    M3
c  a  c  a  b    M2
c  c  a  b  a    M1
How can I make, like:
x1 x2 x3 x4  class
a  b  a  c  c    M1
c  c  a  a  a    M1
c 
2007 Jan 27
1
Canging the type of point points sizein plots..
I want to plot variation of more than one variable in
single plot with different point types and points
sizes . Can someone help me to do that,
Thanks in advance.
vinod
 
____________________________________________________________________________________
Now that's room service!  Choose from over 150,000 hotels
2006 Aug 20
2
how to the p-values or t-values from the lm's results
Dear friends,
  After running the lm() model, we can get summary resluts like the
following:
Coefficients:
   Estimate  Std. Error  t value Pr(>|t|)
x1  0.11562    0.10994   1.052   0.2957
x2 -0.13879    0.09674  -1.435   0.1548
x3  0.01051    0.09862   0.107   0.9153
x4  0.14183    0.08471   1.674   0.0975 .
x5  0.18995    0.10482   1.812   0.0732 .
x6  0.24832    0.10059   2.469   0.0154 *
x7
2009 Sep 11
1
Constructing variables conditional on two indicators
Dear R users
I have a data frame that looks like this:
m         j           X1         X2
1          1
1          2
1          ...
1          J
2          1
2          2
2          ...
2          J
.
.
.
M         1
M         2
M         ...
M         J
The data frame essentially looks like a panel: m and j are indicators where m is 1:M and j is 1:J (and M > J); X1 and X2 are variables.  I
2006 Nov 21
2
using nested ifelse and rowSums to create new variable?
Dear R-help community,
If I have a data.frame df as follows:
> df
   x1 x2 x3 x4 x5 x6
1   5  5  1  1  2  1
2   5  5  5  5  1  5
3   1  5  5  5  5  5
4   5  5  1  4  5  5
5   5  1  5  2  4  1
6   5  1  5  4  5  1
7   5  1  5  4  4  5
8   5  1  1  1  1  5
9   1  5  1  1  2  5
10  5  1  5  4  5  5
11  1  5  5  2  1  1
12  5  5  5  4  4  1
13  1  5  1  4  4  1
14  1  1  5  4  5  5
15  1  5  5  4
2006 Aug 31
3
what's wrong with my simulation programs on logistic regression
Dear friends,
 I'm doing a simulation on logistic regression model, but the programs can't
work well,please help me to correct it and give some suggestions.
My programs:
data<-matrix(rnorm(400),ncol=8)  #sample size is 50
data<-data.frame(data)
names(data)<-c(paste("x",1:8,sep=""))  #8 independent variables,x1-x8;
#logistic regression model is
2006 Jun 06
2
How to create list of objects?
Hi
I am doing several mle and want to store them in a list (or whatever is
the right construct) to be able to analyse them later.
at the moment I am doing:
f <- list()
f$IP <- mle(...)
f$NE <- mle(...)
but when I say:
> summary(f)
I get:
     Length Class Mode
IP   0      mle   list
NE   0      mle   list
I don't get the output I would have, i.e. the one from
>
2007 Jul 17
2
multiple rugs on a single plot
Hi
 
I could only find some discussion on this wrt lattice graphics (which I'm
not using). Apologies if I'm missing something obvious. 
 
I'd like to produce 3 rug plots under a kernel density plot for a
population. The population is subdivided into 3 subpopulations, which I'd
like the rug plots to highlight. Naturally, when I do 3 rug plots, they all
plot over each other.
2006 May 19
5
Converting character strings to numeric
I assume that I have missed something fundamental and that it is there in front of me in "An Introduction to R", but I need someone to point me in the right direction.
> x1 <- "1159 1129 1124 -5 -0.44 -1.52"
> x2 <- c("1159","1129","1124","-5","-0.44","-1.52")
> x3 <- unlist(strsplit(x1,"
2005 Jan 19
1
Imputation missing observations
>From Internet I downloaded the file Hmisc.zip and used it for R package updation. and R gave the message 'Hmisc' successfull unpacked. 
But when I use the functions like aregImpute the package is displaying coundn't find the function
Where as in help.search it is giving that use of the function
>