Displaying 20 results from an estimated 30000 matches similar to: "how to checking whether elements of a vector changed or not."
2009 Jul 21
4
how to transform m/d/yyyy to yyyymmdd?
Hello,
I have a set of data that has a Date column looks like this:
12/9/2007
12/16/2007
1/1/2008
1/3/2008
1/12/2008
etc.
I'd like the date to look something like the follow (so that I could sort by
date easily).
20071209
20071216
20080101
20080103
20080112
How to do it? Thank you very much
Julia
--
View this message in context:
2008 Sep 11
3
Calculate mean/var by ID
Hello,
I have a data set that looks like this.
ID value
111 5
111 6
111 2
178 7
178 3
138 3
138 8
138 7
138 6
.
.
.
I'd like to calculate the mean and var for each object identified by the ID.
I can in theory just loop through the whole thing..., but is there a easier
way/command which let me calculate the mean/var by ID?
Thanks,
Julia
--
View this
2008 Oct 10
4
how to store lme/lmer fit result
Dear R users,
I am building a hierarchical model on a large data set. It can take quite
some time to finish one fit, I was just wondering whether it is possible to
store the fit object (the result) to a file for later (offline) analysis.
thanks
Julia
--
View this message in context: http://www.nabble.com/how-to-store-lme-lmer-fit-result-tp19910951p19910951.html
Sent from the R help mailing
2009 Jun 17
3
how to read in only some columns of a data file
Hello,
I have a data file (.csv) that has a size of about 2.6 GB. I am not able to
read in the whole data set because of the memory limit. I actually only need
some columns (3 columns) of the data set, is there a way to read in
specified columns?
I am using windows.
Thanks,
Julia
--
View this message in context:
2009 Feb 11
3
two scatter plots in one
Dear R users,
I need to compare two scatter plots,
plot(x1, y1)
plot(x2, y2)
and would like to plot them in the same figure. How do I do it?
Thank you.
--
View this message in context: http://www.nabble.com/two-scatter-plots-in-one-tp21963375p21963375.html
Sent from the R help mailing list archive at Nabble.com.
2009 Jan 12
3
roll weekly data to monthly level
Dear R users:
I have a data set that looks something like this:
ID time y
1 2/01/2008 4
1 2/09/2008 12
1 9/01/2008 8
2 1/06/2008 3
2 3/01/2008 4
2 3/09/2008 9
2 6/03/2008 4
3 1/02/2008 3
3 1/10/2008 8
3 2/02/2008 7
3 2/10/2008 3
I'd like to sum up the weekly data to the monthly level, so that it looks
something
2008 Sep 30
1
Adding legends to a plot
Hello,
I have a time series plot drawn using 3 different colored lines, each line
corresponds to different category group. I'd like to put legends on the
plot. I am using "legend" to do this, however, I can either specify lty or
col in legend. Will I be able to do the following in the legend box: a solid
black line then g1, a solid red line then g2, a solid blue line then g3?
2008 Oct 30
1
How to increase iteration limit for lmer()?
Dear R users:
I am running lmer(), and I had the following warning message:
"In mer_finalize(ans): iteration limit reached without convergence (9)
What is the default limit for lmer()? And how do I increase the limit?
Many thanks,
Julia
--
View this message in context: http://www.nabble.com/How-to-increase-iteration-limit-for-lmer%28%29--tp20252974p20252974.html
Sent from the R help
2009 May 29
1
frequence of patterns in a vector
Dear R users,
Suppose I have a vector that consists of characters like ABC, A02, RCA,
etc., and there are about 700 of possible characters. For example,
x <- c("ABC", "ABC", "ABC", "A02", "ABC", "RCA", "ABC", "ABC")
I'd like to get a frequency matrix that looks something like this:
ABC 6
A02 1
RCA 1
I
2009 Jan 20
2
Summing Select Columns of a Data Frame?
Hi,
I would like to operate on certain columns in a dataframe, but not
others. My data looks like this:
x1 x2 x3
1 2 3
4 5 6
7 8 9
I want to create a new column named x4 that is the sum of x1 and x2,
but NOT x3. I looked at colSums and apply, but those functions seem to
use all the columns in a dataframe. How do I only use select columns?
If it helps, in Stata this would be gen x4
2011 Nov 26
1
Constrained linear regression
Dear all,
I need to run a simple linear regression such that:
y = b0 + b1*x1 + (1-b1)*x2 + e
which I know I can use:
lm(y ~ I(x1 - x2) + offset(x2)).
However, I also need to restrict the coefficient b1 to be between 0 and 1.
Is there any way to include such restriction in the linear regression estimation?
I saw suggestion related with the function Solve.QP, but I really did not understand such
2010 Oct 19
2
separate elements of a character vector
Dear colleagues, this seems like an easy problem, and I found some suggestions which I've incorporated in the help list, but I can't quite get it right.
I want to add a series of years to a second x-axis category label. I generate them with test and test_2 below, format them with some spacing (which is the suggestion I took from the R-list) and concatenate them and then write them with
2012 Oct 14
1
Efficient method: Equality of all elements of two vectors
n=10
x1<-(1:n)/n
y1<-rnorm(n,x1^2,1)
m=20
x2<-(1:m)/m
The value of y2 will be rnorm (m, x2^2,1) if none of the elements of x2 is same as x1, but for every same elements in x1 and x2, the value of y2 will be same as y1. I know the following is correct, but for large vectors, this won't work efficiently as this is taking longer time. Can you please let me know how to write the
2008 Oct 16
1
increase memory limit in R
Dear R users,
I am running lmer() and having memory problem: "reached total allocation of
1535Mb".
The lmer() function was successful (no errors or warnings). However when I
do "summary(fit.lmer), I got this "Error: cannot allocate vector of size
19.5 Mb). I used memory.size() and got 1880. I used memory.limit(2500) to
increase the memory size to 2500Mb, however I still get
2009 Sep 24
1
multinormial runs tests?
Dear R users,
I would like to test the randomness in a series of N values (N>=2). I know
that runs.test works for dichotomous factor only:
x <- rep(c(1,2), 50)
runs.test(factor(x))
However it doesn't work for series that can take any N values (N>2):
x <- rep(c(1,2,5,4),50)
runs.test(factor(x))
Error in runs.test(factor(x)) : x does not contain dichotomous data
Are there any R
2008 Oct 08
2
detect repeated number in a vector
Dear R users,
I have this vector that consists numeric numbers. Is there a command that
detects the repeated numbers in a vector and returns the index of the
repeated numbers (or the actual numbers)? For example, v <- c(3,4,5,7,4).
The command would return me index 2 and 5 (or the repeated number, 4).
Thank you very much,
Julia
--
View this message in context:
2010 Apr 15
3
[LLVMdev] whether these transformations are doable and how?
Thanks for all the replies which are really helpful.
one more question regarding transformation:
4. Given an instruction %x1 = I1, can I replace the rhs "I1" with "I2"
and get a new instruction %x1 = I2? Alternatively, I can add a new
instruction %x2 = I2, and replace all uses of %x1 with %x2, and then delete
%x1 = I1, but it seems the former is simpler or faster if
2009 Mar 28
4
Selecting elements from a vector (a simple question with weird results)
Hello people.
I wish to reorder a simple vector of numbers by another vector of the order
(and then do the same, but with a data frame rows)
I try this (which doesn't work) :
> aa <- c(3, 1 ,2 )
> aa[aa]
[1] 2 3 1
The same won't work if I try to order a data frame:
> data.frame(matrix(c(3,1,2), 3,2))[c(3,1,2),]
X1 X2
3 2 2
1 3 3
2 1 1
How should I do this?
p.s:
2010 Apr 15
0
[LLVMdev] whether these transformations are doable and how?
On Wed, Apr 14, 2010 at 5:45 PM, Neal N. Wang <neal.wang at gmail.com> wrote:
> Thanks for all the replies which are really helpful.
>
> one more question regarding transformation:
>
> 4. Given an instruction %x1 = I1, can I replace the rhs "I1" with "I2"
> and get a new instruction %x1 = I2? Alternatively, I can add a new
> instruction %x2 =
2011 Nov 19
1
wald test: compare quantile regression estimators from different samples
Dear all,
I am trying to compare the estimated coefficients of a quantile regression model between two different samples. It is a Wald test, but I cannot find one way to do that in R.The samples are collected conditional on a specific characteristic and I would like to test whether such characteristic indeed affect the estimators. The problem in the test anova.rq is that the response variable