Displaying 20 results from an estimated 60000 matches similar to: "Error in which()"
2010 Apr 22
3
using which to select range of values
Hi all,
I would like to get the array index for a range of values, say 0 < x <
1.5. I'm wondering if there is an alternative for the following which
I've done
x0 <- rnorm(100)
x1 <- ifelse(x0 > 0 & x0 < 1.5,"t","f")
x2 <- which(x1=="t",arr.ind=TRUE)
x0[x2]
Thanks.
--
Muhammad
2010 Sep 08
11
problem with outer
Hello,
i wrote this function guete and now i want to plot it: but i get this error
message. i hope someone can help me.
Error in dim(robj) <- c(dX, dY) :
dims [product 16] do not match the length of object [1]
p_11=seq(0,0.3,0.1)
p_12=seq(0.1,0.4,0.1)
guete = function(p_11,p_12) {
set.seed(1000)
S_vek=matrix(0,nrow=N,ncol=1)
for(i in 1:N) {
X_0=rmultinom(q-1,size=1,prob=p_0)
2012 Jul 02
4
how to do a graph with tree different colors??
hi
i try to do a graph of a time series which shows in red the values > -0.05,
in blue the values >0.05 and in white the values between -0.05 and 0.05
for un exemple :http://www.appinsys.com/globalwarming/enso.htm
thanks !!!!!
denisse
--
View this message in context: http://r.789695.n4.nabble.com/how-to-do-a-graph-with-tree-different-colors-tp4635206.html
Sent from the R help mailing
2012 Jul 06
3
estimating NA values against selected slots
Dear R Users,
Could you please help me on the following issue?
I have a real large yearly data set. For each year I have
365 flow values. Some of the flow values are not known and that’s why you will
see NA written in those slots. I wanted to know, is there a way that I can
estimate those values? I tried approx command but it seems least helpful for
the kind of issue I am up against.
2010 Jan 29
2
Create matrix with subset from unlist
Hello all,
I'm trying to create a 2x2 matrix, 32 times after unlist() so that I can
convert the list to matrix. I've looked through the R archive but
couldn't find the answer. There is what I've done.
> f <- system("ls *.txt", intern=TRUE)
> x <- lapply(f, read.table)
> x
[[1]]
V1 V2
1 -27.3 14.4
2 29.0 -38.1
[[2]]
V1 V2
1 14.4
2012 Jul 10
2
estimation of NA by predict command
Dear arun and all R users,
I will first of all try to simply define my issue..
I have data in the following format
Year Discharge
dd/mm/yyyy x
.. …
… …
There are some NA values in the discharge which I would like to predict by using “predict command”. I cant figure out the way to write the coding for that. Could you please help me on that???
I have also ,written
2005 Apr 27
4
How to add some of data in the first place dataset
Dear R-help,
First I apologize if my question is quite simple.
I need add some of data in the first place my dataset, how can I do that.
I have tried with rbind, but I did not succes.
0.1 3.6 0.4 0.9 rose
4.1 4.0 1.2 1.2 rose
4.4 3.2 1.9 0.5 rose
4.6 1.1 1.1 0.2 rose
For example,
2006 Jun 25
1
Puzzled with contour()
Folks,
The contour() function wants x and y to be in increasing order. I have
a situation where I have a grid in x and y, and associated z values,
which looks like this:
x y z
[1,] 0.00 20 1.000
[2,] 0.00 30 1.000
[3,] 0.00 40 1.000
[4,] 0.00 50 1.000
[5,] 0.00 60 1.000
[6,] 0.00 70 1.000
[7,] 0.00 80 0.000
[8,] 0.00 90
2007 Oct 22
2
Help interpreting output of Rprof
Hello there,
I am not quite sure how to interpret the output of Rprof (in the following the output I was staring at). I was poking around the web a little bit for documentation but without much success. I guess if I want to figure out what takes so long in my code the 2nd table $by.total and the total.pct column (pct = percent) is the most helpful. What does it mean that [ or [.data.frame is
2012 Nov 30
4
qbinom
a=c(0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9)
b=c(0.9, 0.8, 0.7, 0.6, 0.5, 0.4, 0.3, 0.2, 0.1)
cor(a,b)= -1
a'=qbinom(a, 1, 0.5)
b'=qbinom(b, 1, 0.5)
why cor(a',b') becomes -0.5 ?
--
View this message in context: http://r.789695.n4.nabble.com/qbinom-tp4651460.html
Sent from the R help mailing list archive at Nabble.com.
2004 Sep 03
6
seq
Hi everyone,
I've tried the below on R 1.9.1 and the 2004-08-30 builds of R 1.9.1
Patched and R 2.0.0 on Windows 2000, and the results are consistent.
> seq(0.5, 0, by = -0.1)
[1] 0.5 0.4 0.3 0.2 0.1 0.0
> seq(0.7, 0, by = -0.1)
[1] 7.000000e-01 6.000000e-01 5.000000e-01 4.000000e-01 3.000000e-01
2.000000e-01 1.000000e-01 -1.110223e-16
Is this really the intended behaviour?
2008 Jul 02
2
Reading CSV file with unequal record length
Hello ,
I am having some difficulty reading a CSV file of unequal record length
in R . The data has 26 columns and do not have header and is generated
from a R syntax -
write.table(schat,"schat.csv", sep=",", col.names=FALSE, append = TRUE)
1.0,1.0,0.0,0.1,0.1,0.1,0.2,0.2,0.3,0.3,0.4,0.4,0.5,0.6,0.7,0.8,0.9,1.0,1.2,1.5,1.9,2.7,,,,
2013 May 29
3
bootstrap
Hi,
You might need to check library(boot).? I have never used that before.? So, I can't comment much.? It is better to post on R-help list.? I had seen your postings on Nabble in the past.? Unfortunately those postings were not accepted in R-help.? You have to directly post at ? r-help at r-project.org after registering at:
https://stat.ethz.ch/mailman/listinfo/r-help
?
2007 Feb 22
2
Is there better alternative to this loop?
Dear List,
Thanks to those who helped with my enquiry a few days ago.
I have a another question on loops, in this case I am trying to print out
the row of a data frame if the previous 3 values (daily values) in col5 are
in descending order. I have this loop which works, but ask whether this can
be done differently (without conventional loop) in R:
flag="T"
d= 3 # d represents
2011 Jun 07
2
Line Graphs
Hello,
I want to plot 6 line graphs. I have 10 points 0.1, 0.2, 0.3, 0.4, 0.5, 0.6,
0.7, 0.8, 0.9 and 1.0.
At each point say 0.1, I have 6 variables A, B, C, D, E and F. The variables
all have values between 0 and 1 (and including 0 and 1). I also want to
label the x axis from 0.1 to 1.0 and the y axis from 0.1 to 1.0.
My goal is to plot a line graph representing the mean of the variables at
each
2012 Jul 24
5
First value in a row
Hi.
This is likely a trivial problem but have not found a solution.
Imagine the following dataframe:
Lat Lon x1 x2 x3
01 10 NA NA .1
01 11 NA .2 .3
01 12 .4 .5 .6
I want to generate another column that consist of the first value in
each row from columns x1 to x3. That is
NewColumn
.1
.2
.4
Any input greatly appreciated,
Thanks,
Camilo
Camilo Mora, Ph.D.
2009 Dec 03
2
Help R2WinBUGS
Hello,
I have problem running WinBUGS from R.
The following example works in WinBUGS but it does not work in R through
package R2WinBUGS.
Does anyone know what the problem is?
x <- c(0.2, 1.1, 1, 2.2, 2.5, 2.9, 2.9, 3.6, 3.8, 0.6, 1, 2, 2.4, 2.6, 2.8,
3.2, 3.9, 3.5)
y <- c(0.5, 1.3, 0.1, 0.7, -0.4, 0.5, -0.9, -0.3, -0.3, 0.6, 0.4, 0.9, -0.1,
-0.4, -0.5, -0.2, 0.3, -1.5)
eco <- c(1, 3,
2011 Mar 07
2
rowSums - am I getting something wrong?
I am trying to construct a data set with some sequences for example:
a = seq(0,1,0.1)
m = matrix(nrow = 1331, ncol = 3)
m[,1] = rep(a,121)
m[,2] = rep(a,11,each = 11)
m[,3] = rep(a,1,each = 121)
I realize that there may be better ways of doing this, but this approach demonstrates the problem I'm having.
I then want to get the sum of the rows and delete any row with a sum of greater than 1.
2013 Feb 17
1
addition in the initial question
Dear Elisa,
Try this:
vec1<-c(33,18,13,47,30,10,6,21,39,25,40,29,14,16,44,1,41,4,15,20,46,32,38,5,31,12,48,27,36,24,34,2,35,11,42,9,8,7,26,22,43,17,19,28,23,3,49,37,50,45)
vec2<-vec1[1:26]
names(vec2)<-LETTERS[1:26]
label1<-unlist(lapply(mapply(c,lapply(seq(0,45,5),function(x) x),lapply(seq(5,50,5),function(x) x),SIMPLIFY=FALSE),function(i)
2011 Nov 15
5
Convert back to lower triangular matrix
Given a vector;> ab = seq(0.5,1, by=0.1)> ab[1] 0.5 0.6 0.7 0.8 0.9 1.0
The euclidean distance between the vector elements is given by the lower triangular matrix > dd1 = dist(ab,"euclidean")> dd1 1 2 3 4 52 0.1 3 0.2 0.1 4 0.3 0.2 0.1 5 0.4 0.3 0.2 0.1 6 0.5 0.4 0.3 0.2 0.1
Convert the lower triangular matrix to a full