Displaying 20 results from an estimated 7000 matches similar to: "to raise in a loop more than 1"
2006 Feb 20
3
Boxplot Help for Neophyte
R helpers
I am getting to grips with R but came across a small problem today that I
could not fix by myself.
I have 3 text files, each with a single column of data. I read them in
using:
myData1<-scan("C:/Program Files/R/myData1.txt")
myData2<-scan("C:/Program Files/R/myData2.txt")
myData3<-scan("C:/Program Files/R/myData3.txt")
I wanted to produce a
2009 Aug 06
2
random between two values
Hi,
I would obtain a random value between two (for example between 40.15 and 56.58 I would have only one value).
I'm looking for a package/a function which could do this.
Could anybody help me please?
Cordialement
Damien Landais
2009 Sep 21
3
compute differences
Hi,
I have a problem.
I have a data frame looking like:
ID val
A? .3
B? 1.2
C? 3.4
D? 2.2
E? 2.0
I need to CREATE the following TABLE:
CASE?? DIFF
A-A??? 0
A-B??? -0.9
A-C??? -3.1
A-D??? -1.9
A-E??? -1.7
B-A??? ...
B-B??? ...
B-C
B-D
B-E
C-A
C-B
C-C
C-D
C-E
D-A
D-B
D-C
D-D
D-E
E-A
E-B
E-C
E-D
E-E
WHERE CASE IS THE COUPLE OF ELEMENTS CONSIDEREDM AND DIFF IS THE computed DIFFERENCE between
2007 Aug 10
7
Help wit matrices
Hello all,
I am working with a 1000x1000 matrix, and I would like to return a
1000x1000 matrix that tells me which value in the matrix is greater
than a theshold value (1 or 0 indicator).
i have tried
mat2<-as.matrix(as.numeric(mat1>0.25))
but that returns a 1:100000 matrix.
I have also tried for loops, but they are grossly inefficient.
THanks for all your help in advance.
Lanre
2007 Mar 02
2
sampling random groups with all observations in the group
Hi
I have a panel dataset with large number of groups and differing number
of observations for each group. I want to randomly select say, 20% of
the groups or 200 groups, but along with all observations from the
selcted groups (with the corresponding data).
I guess it is possible to generate a random sample from the groups ids
and then match that with the entire dataset to have the intended
2009 Jun 10
2
plot two variograms on a same graph
Hi,
I would know how to plot two variograms on a same graph. I can plot one by one but I would draw both on the same one.
Is it possible? Do i need any special package?
Thanks!
Cordialement
Damien Landais
2011 Feb 25
1
speed up process
Dear users,
I have a double for loop that does exactly what I want, but is quite
slow. It is not so much with this simplified example, but IRL it is slow.
Can anyone help me improve it?
The data and code for foo_reg() are available at the end of the email; I
preferred going directly into the problematic part.
Here is the code (I tried to simplify it but I cannot do it too much or
else it
2007 Mar 08
1
R: Searching and deleting elements of list
you could try mapply
mydata2<-mapply("[", mydata, lapply(mydata, function(x) !x %in% A))
mydata2[[1]]<-A #to replace the obviously deleted elements of "A"
mydata2
mydata2[[1]]
mydata2[[2]]
mydata2[[3]]
mydata2[[4]]
Stefano
-----Messaggio originale-----
Da: r-help-bounces at stat.math.ethz.ch
[mailto:r-help-bounces at stat.math.ethz.ch]Per conto di jastar
2007 Mar 08
1
Searching and deleting elements of list
Hi,
I have a problem. Please, look at example and try to help me!!
> A<-c("aaa","bbb","ccc","ddd","eee")
> B<-c("vvv","ooo","aaa","eee","zzz","bbb")
> C<-c("sss","jjj","ppp","ddd")
> D<-c("bbb","ccc")
2010 Aug 19
1
zoo. window
Hi,
I have a dataset including monthly date from 1971-01-01 to 2009-01-01. The dates are character variables.
I want to select the subsample from my original data, so I use
mydata3<-window(mydata,start="1972-02-01",end="2005-02-01"),
or mydata3<-window(mydata, start=as.date("1972-02-01"),end=as.date("2005-02-01"))
or mydata3<-window(mydata,
2001 Dec 19
2
How to create a data.frame "like" another, but longer?
Hello,
does anyone know of a quick way to create a data frame "like" another, but
with more rows?
What I'd like to do is this:
if mydata is a data.frame like
a b c
1 TRUE yes
2 FALSE no
3 TRUE yes
I'd like to get mydata2 with the same column names and column types, but
without the values and with more rows.
All I could think of was to manually do
2011 Jun 21
5
converting character to numeric
I'm trying to convert data from character to numeric.
I've imported data as a csv file, I'm assuming that the import is a
database - are all the columns in a database considered "vectors" and that
they can be operated on individually
Therefore I've tried the following
mydata <- as.numeric(mydata$apples)
when i then look at mydata again the named column is still
2011 Feb 24
1
Selecting data based on the range of dates
Hi:
I want to give an index with all the dates between Sept. to Nov. as 1, and
anything else is 0. It doesn't matter which year it is, as long as it is
between Sept. to Nov, then set up to 1, otherwise is 0.
My data frame looks like below:
ID Date
201 1/1/05 6:07 AM
201 3/27/09 9:45 AM
201 9/29/09 8:44 AM
203 10/16/08 10:01 AM
203 10/28/08 9:45 AM
203 10/31/08 11:12 AM
203 11/7/08 11:32 AM
2012 Jan 01
1
How to pass in a list of variables as an argument to a function?
Hello,
I have some code that currently works fine and I am endeavoring to
convert the major pieces of it into functions.
This involves taking "hard coded" names of variables that are used in
various places and figuring out how to
abstract them out into functions where the arguments (i.e. a list of
variables)?can be passed to the parent function
and used within that function for various
2012 Oct 20
2
Help with programming a tricky algorithm
Hi All,
I'm a little stumped by the following problem. I've got a dataset with
the following structure:
idxy ix iy country (other variables)
1 1 1 c1 x1
2 1 2 c1 x2
3 1 3 c1 x3
. . . . .
3739 55 67 c7 x3739
3740 55 68 c7 x3740
where ix and
2006 Nov 09
1
dissimilarity matrices
Dear All,
I have a dissimilarity matrix which I happily convert to a distance object
by running:
X <- as.dist(Y)
and I can happily now run either hclust(X) or agnes(X).
So that the various bits of output are labelled correctly I would dearly
like to be able to give names to the columns and rows of X, as would happen
if I ran:
mydata<-read.table("clipboard",header=T)
2010 Nov 11
2
Kolmogorov Smirnov Test
I'm using ks.test (mydata, dnorm) on my data. I know some of my
different variable samples (mydata1, mydata2, etc) must be normally
distributed but the p value is always < 2.0^-16 (the 2.0 can change
but not the exponent).
I want to test mydata against a normal distribution. What could I be
doing wrong?
I tried instead using rnorm to create a normal distribution: y = rnorm
2012 Nov 14
2
Jackknife in Logistic Regression
Dear R friends
I´m interested into apply a Jackknife analysis to in order to quantify the
uncertainty of my coefficients estimated by the logistic regression. I´m
using a glm(family=’binomial’) because my independent variable is in 0 - 1
format.
My dataset has 76000 obs, and I´m using 7 independent variables plus an
offset. The idea involves to split the data in let’s say 5 random subsets
and
2008 Jul 24
4
Dividing by 0
I'm trying to calculate the percent change for a time-series variable.
Basically the first several observations often look like this,
x <- c(100, 0, 0, 150, 130, 0, 0, 200, 0)
and then later in the life of the variable they're are generally no more
0's. So when I try to calculate the percent change from one observation to
the next, I end up with a lot of NA/Nan/INF, and
2009 Jun 11
0
Variogram fitted by Cauchy
Hi
I'm using R(2.9.0) and gstat package under Windows to plot sample variograms.
When I want to fit them, I don't have the possibility to choose Cauchy functions. Under Mathematica for example, we have it and it seems to be the best one to fit the variograms I have
I tested the others functions, they can fit but I would,if possible, use the Cauchy one. If anybody knows something about