Displaying 20 results from an estimated 10000 matches similar to: "error message: .Random.seed is not an integer vector but"
2009 Jul 23
5
error message: .Random.seed is not an integer vector but of type 'list'
I'm trying to run this simple random sample procedure and keep getting the
error message shown. I don't understand this; I've designated x as a
numeric vector, so what is going on here? Thanks.
> x = as.vector(c(1:12));x
[1] 1 2 3 4 5 6 7 8 9 10 11 12
> mode(x)
[1] "numeric"
> sample(x, 3)
Error in sample(x, 3) :
.Random.seed is not an integer vector
2009 Jul 23
5
Random # generator accuracy
Dan Nordlund wrote:
"It would be necessary to see the code for your 'brief test' before anyone
could meaningfully comment on your results. But your results for a single
test could have been a valid "random" result."
I've re-created what I did below. The problem appears to be with the
weighting process: the unweighted sample came out much closer to the actual
2010 May 06
2
splitting character strings and converting to numeric vectors
This seemingly should be quite simple but I can't solve it:
I have a long character vector of geographic data (data frame column named
"XY") whose elements vary in length (from 11 to 14 chars). Each element is
structured as a set of digits, then an underscore, then more digits, e.g:
> data.frame(head(as.character(XY)))
head.as.character.XY..
1 -448623_854854
2
2010 May 12
1
removing duplicate rows
I'm trying to identify and remove rows in a data frame that are duplicated
only on particular columns within it (i.e. not on all columns). The
"unique" function looks for uniqueness across all columns of a data frame.
Identifying unique rows based only on specific columns of interest returns
only those columns, not all of the columns in the original frame. I tried
this, and then
2009 Aug 10
4
problem selecting rows meeting a criterion
When I try to select only those rows from the following data frame, called
"data", in which X > Y
X Y V3
2 2 1 8.062258
3 3 1 2.236068
4 4 1 6.324555
5 5 1 5.000000
6 1 2 8.062258
8 3 2 9.486833
9 4 2 2.236068
10 5 2 5.656854
11 1 3 2.236068
12 2 3 9.486833
14 4 3 8.062258
15 5 3 5.099020
16 1 4 6.324555
17 2 4 2.236068
18 3 4 8.062258
20 5 4 5.385165
21 1 5 5.000000
2009 Aug 04
2
R's database capabilities
I admit that I've not done a thorough search on this topic, but from the
several instructional manuals and/or tutorials I've looked at, I don't see
any mention of relational database capabilities in R? Have I missed
something, and if so, can someone point me in the right direction to get
started? Thanks!
Jim Bouldin, PhD
Research Ecologist
Department of Plant Sciences, UC Davis
2010 Sep 08
6
'par mfrow' and not filling horizontally
Greetings, Folks.
I'd appreciate being shown the way out of this one!
I've been round the documentation in ever-drecreasing
circles, and along other paths, without stumbling on
the answer.
The background to the question can be exemplified by
the example (no graphics window open to start with):
set.seed(54321)
X0 <- rnorm(50) ; Y0 <- rnorm(50)
2010 Jul 07
3
quantiles on rows of a matrix
I'm trying to obtain the mean of the middle 95% of the values from each row
of a matrix (that is, the highest and lowest 2.5% of values in each row
are removed before calculating the mean). I am having all sorts of
problems with this; for example the command:
apply(matrix1,1,function(x) quantile(c(.05,.90),na.rm=T))
returns the exact same quantile values for each row, which is clearly
2009 Apr 30
1
unloading loaded packages
I can't seem to find info on how to unload packages that have been loaded.
My goal in doing so is to gain access to functions that have been masked
out by those packages. Or is there another way to do so? Thanks in advance.
Jim Bouldin, PhD
Research Ecologist
Department of Plant Sciences, UC Davis
Davis CA, 95616
530-554-1740
2009 Dec 28
1
nls error message
When I try to run the following non-linear regression with variables
index1 and prl3:
> beta = 4
> nls(index1~beta*(1/prl3),start = list(beta = 4))
I get this error message:
Error in nls(index1 ~ beta * (1/prl3), start = list(beta = 4)) :
REAL() can only be applied to a 'numeric', not a 'logical'
I've got no clue as to the REAL() to which this is referring. Any
2010 Jan 03
1
calculations on columns with partially matching names
Is there a command for partial matching of character strings? Specifically,
I'd like to be able to calculate the mean of the values in any columns in a
data frame or matrix that have identity in part of their column names. For
example, columns labeled "mpw06a" and "mpw06b" match on the first five
characters; their mean would be taken whereas any columns beginning with
2010 Mar 11
3
NAs and row/column calculations
I continue to have great frustrations with NA values--in particular making
summary calculations on rows or cols of a matrix containing them. For
example, why does:
> a = matrix(1:30,nrow=5)
> is.na(a[c(1:2),c(3:4)]);a
[,1] [,2] [,3] [,4] [,5] [,6]
[1,] 1 6 NA NA 21 26
[2,] 2 7 NA NA 22 27
[3,] 3 8 13 18 23 28
[4,] 4 9 14 19 24 29
2009 Dec 04
1
no html help upon upgrading to 2.10
I just upgraded from 2.8.1 to 2.10 on Windows Vista. BIG MISTAKE
apparently because now when I type:
> help(functionname)
or
?functionname
I get only a small text window giving some very basic info on the topic, e.g.:
base-package package:base R Documentation
The R Base Package
Description:
Base R functions
Details:
This package contains the
2009 Nov 24
2
linear regression on groups of consecutive rows of a matrix
I want to perform linear regression on groups of consecutive rows--say 5 to
10 such--of two matrices. There are many such potential groups because the
matrices have thousands of rows. The matrices are both of the form:
> shp[1:5,16:20]
SL495B SL004C SL005C SL005A SL017A
-2649 1.06 0.56 NA NA NA
-2648 0.97 0.57 NA NA NA
-2647 0.46 0.30 NA NA
2008 Mar 12
1
[follow-up] "Longitudinal" with binary covariates and outcome
Hi again!
Following up my previous posting below (to which no response
as yet), I have located a report which situates this type
of question in a longitudinal modelling context.
http://www4.stat.ncsu.edu/~dzhang2/paper/glm.ps
Generalized Linear Models with Longitudinal Covariates
Daowen Zhang & Xihong Lin
(This work seems to originally date from around 1999).
They consider an outcome Y,
2009 Nov 21
7
consecutive numbering of elements in a matrix
Within a very large matrix composed of a mix of values and NAs, e.g, matrix A:
[,1] [,2] [,3]
[1,] 1 NA NA
[2,] 3 NA NA
[3,] 3 10 17
[4,] 4 12 18
[5,] 6 16 19
[6,] 6 22 20
[7,] 5 11 NA
I need to be able to consecutively number, in new columns, the non-NA
values within each column (i.e. A[1,1] A[3,2] and A[3,3] would all be set
to one, and
2008 Oct 20
3
? extended rep()
Hi Folks,
I'm wondering if there's a compact way to achieve the
following. The "dream" is that, by analogy with
rep(c(0,1),times=c(3,4))
# [1] 0 0 0 1 1 1 1
one could write
rep(c(0,1),times=c(3,4,5,6))
which would produce
# [1] 0 0 0 1 1 1 1 0 0 0 0 0 1 1 1 1 1 1
in effect "recycling" x through 'times'.
The objective is to produce a vector of
2009 Feb 05
3
"open-ended" plot limits?
Hi Folks,
Maybe I've missed it already being available somehow,
but if the following isn't available I'd like to suggest it.
If you're happy to let plot() choose its own limits,
then of course plot(x,y) will do it.
If you know what limits you want, then
plot(x,y,xlim=c(x0,x1),ylim(y0,y1)
will do it.
But sometimes one would like to
a) make sure that (e.g.) the y-axis has a
2008 Oct 12
1
png(): Linux vs Windows
Hi Folks,
Quick question. I have the following line in an R code file
which runs fine on Linux:
if(PNG) png(GraphName,width=12,height=15,units="cm",res=200)
I learn that, when the same code was run on a Windows machine,
there was the following error:
Error in png(GraphName,width=12,height=15,units="cm",res=200):
unused argument(s) (units = "cm")
Sorry to
2008 May 20
1
contr.treatments query
Hi Folks,
I'm a bit puzzled by the following (example):
N<-factor(sample(c(1,2,3),1000,replace=TRUE))
unique(N)
# [1] 3 2 1
# Levels: 1 2 3
So far so good. Now:
contrasts(N)<-contr.treatment(3, base=1, contrasts=FALSE)
contrasts(N)
# 1 2
# 1 1 0
# 2 0 1
# 3 0 0
whereas:
contr.treatment(3, base=1, contrasts=FALSE)
# 1 2 3
# 1 1 0 0
# 2 0 1 0
# 3 0 0 1
contr.treatment(3, base=1,