Displaying 20 results from an estimated 20000 matches similar to: "abs(U) > 0 where U is a vector?"
2007 Jun 28
4
compare 2 vectors
Dear all,
I would like to take out the values from one vector that are equal to the values in another vector.
Example:
a <- c(1,2,3,4,5,6,7,8,9)
b <- c(3,10,20,5,6)
b_noRepeats = c(10,20)
So I would like to have the vector b without the same values as vector a.
Kind regards,
João Fadista
[[alternative HTML version deleted]]
2007 Dec 13
6
spliting strings ...
Hi everyone,
I have a vector of strings, each string made up by different number of words. I want to get a new vector which has only the first word of each string in the first vector. I came up with this:
str <- c('aaa bbb', 'cc', 'd eee aa', 'mmm o n')
str1 <- rep(1, length(str))
for (i in 1:length(str)) {
str1[i] <- strsplit(str, "
2005 Sep 25
2
getting variable length numerical gradient
Hi all.
I have a numerical function f(x), with x being a vector of generic
size (say k=4), and I wanna take the numerically computed gradient,
using deriv or numericDeriv (or something else).
My difficulties here are that in deriv and numericDeric the function
is passed as an expression, and one have to pass the list of variables
involved as a char vector... So, it's a pure R programming
2006 Oct 31
4
getMethod(s) and var.test
Hi,
How do I retrieve the var.test() function code? I had a similar problem once
before with another function but getMethods() solved the problem then. Now I
tried several combinations for var.test() without success.
Regards
benjamin
--
Benjamin Otto
Universitaetsklinikum Eppendorf Hamburg
Institut fuer Klinische Chemie
Martinistrasse 52
20246 Hamburg
[[alternative HTML
2008 Mar 13
2
joining matrices, vectors, scalars in one object
Hi,
I have:
a <- matrix(c(0,1,0,1),nrow=2)
b <- matrix(c(1,1,1,0,0,0),nrow=3)
c <- 1
d <- c(1,0,1)
And I would like to join them in an object 'thing' so that I can
access a, b, c, or d through an index in a for loop.
For example:
thing[4]
would return
[1] 1 0 1
Note however, that I have many of these 'thing' components. So many
that a command like
thing
2005 Sep 12
1
poisson mean hypothesis
Dear R-users,
Is there a way to get p-values for a one-sided hypothesis test about a
poisson mean?
Thanks,
Jan Wijffels
University Center for Statistics
W. de Croylaan 54
3001 Heverlee
Belgium
tel: +32 (0)16 322784
fax: +32 (0)16 322831
<http://www.kuleuven.be/ucs> http://www.kuleuven.be/ucs
Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm
[[alternative HTML version
2006 Jan 27
5
How to convert decimals to fractions
Dear all,
Are there any functions to convert decimals to fractions in R?
I have the result:
> summary(as.factor(complete.ID))
0 0.0133333333333333 0.04
2256 488 230
0.0666666666666667 0.0933333333333333 0.106666666666667
2342 310 726
0.133333333333333
2006 Jun 16
3
Vector Manipulation
I have a vector that has 1,974 elements and each element is one of the
following (B, F, N, Y). How do I recreate that vector accept in the
place of N put 0 and in the place of B, F or Y put a 1?
Thanks,
Jacob
[[alternative HTML version deleted]]
2005 Oct 25
8
Can anyone please tell me how to strip the white spaces from a character vector?
for example:
> a$tic[1:10]
[1] "AIR " "ABCB " "ABXA " "ACMR " "ADCT " "ADEX "
[7] "ABM " "AFCE " "AG " "ATG "
Can anyone please tell me how to strip the white spaces from a$tic?
Thanks,
Roger
[[alternative HTML version deleted]]
2007 Jun 10
3
find position
find the position of the first value who equals certain number in a vector:
Say a=c(0,0,0,0,0.2, 0.2, 0.4,0.4,0.5)
i wish to return the index value in a for which the value in the vector is
equal to 0.4 for the first time. in this case, it is 7.
[[alternative HTML version deleted]]
2007 Jan 08
4
Export dataframe to txt
Hi all,
Is there a function to export a dataframe to a text file?
I want to store a large set of data which I have saved in a dataframe
in my workspace and copy and past doesn't cut it.
Thank you,
Benjamin
2007 May 11
1
Create an AR(1) covariance matrix
Hi All.
I need to create a first-order autoregressive covariance matrix
(AR(1)) for a longitudinal mixed-model simulation. I can do this
using nested "for" loops but I'm trying to improve my R coding
proficiency and am curious how it might be done in a more elegant
manner.
To be clear, if there are 5 time points then the AR(1) matrix is 5x5
where the diagonal is a constant
2006 Oct 26
4
Header of dataframe
Hi
I am fairly new to R and I would appreciate some help to hopefully a
trivial problem.
I created a function:
summary.aggregate <- function(y, ...)
{
temp.mean <- aggregate(y, FUN=mean, ...)
temp.sd <- aggregate(y, FUN=sd, ...)
temp.length <- aggregate(y, FUN=length, ...)
temp <- data.frame(cbind(mean=temp.mean$x,stdev=temp.sd$x,n=temp.length$x))
}
this outputs e.g.:
2005 Apr 19
1
chi-square test
a warning message appears when i use the chisq.test ,but it doesnt
appear everytime, why?
"Warning message:
Chi-squared approximation may be incorrect in:
chisq.test(matrix(c(20.1, 18.5, 2.6, 32.9, 23.5, 5.4), nc = 2)) "
why does the warning message appear, please?
Thank you very much
here is the data which I have tried appear and not appear warning
message
have warning message
2006 May 12
3
Maximum likelihood estimate of bivariate vonmises-weibulldistribution
Thanks Dimitris!!! That's much clearer now. Still have a lot of work to
do this weekend to understand every bit but your code will prove very
useful.
Cheers,
Aziz
-----Original Message-----
From: Dimitrios Rizopoulos [mailto:Dimitris.Rizopoulos at med.kuleuven.be]
Sent: May 12, 2006 4:35 PM
To: Chaouch, Aziz
Subject: RE: [R] Maximum likelihood estimate of bivariate
2007 Jul 23
3
extraction of vector elements to new list
Dear R-community,
I have got a list of vectors and would like to extract the first two
elements of each vector to a new list.
My list is of the style:
my.list = list(c("a", "b", "c"), c("d", "e"), c("f", "g", "h", "i"), ...)
#I want:
new.list = list(c("a", "b"), c("d",
2008 Apr 09
4
apply lm() for all the columns of a matrix
Hi all,
My question is not really urgent. I can write a loop and solve the
problem. But I know that I'll be in a similar situation many more times so
it would be useful to find out the answer
Is there a fast way to perform linear fit to all the columns of a matrix?
(or in the one dimension of a multi-dimensional array.) I'm talking about
many single linear fits, not about a multiple fit.
2005 Jan 25
3
Plotting only masked part of data
Hello,
I have x and y data to plot (synthetic example):
x <- seq(0,4*pi,by=0.1)
y <- sin(x)
I then want to plot (x,y) in those points where abs(y) is smaller than
0.5. As a first approximation
plot(x[abs(y) < 0.5],y[abs(y) < 0.5])
is quite close - however I want to plot with lines, i.e. type="l", and
then I get solid lines connecting the endpoint of one
2007 Jan 08
3
Speeding things up
Hi,
is it possible to do this operation faster? I am going over 35k data
entries and this takes quite some time.
for(cnt in 2:length(sdata$date))
{
if(sdata$value[cnt] < sdata$value[cnt - 1]) {
sdata$ddtd[cnt] <- sdata$ddtd[cnt - 1] + sdata$value[cnt - 1] -
sdata$value[cnt]
}
else sdata$ddtd[cnt] <- 0
}
return(sdata)
Thank you,
Benjamin
2004 Dec 07
4
Importing vector graphics into R
Dear R users,
I know of the possibility to import bitmaps via the nice pixmap library.
But if you later on create a PDF it is somewhat disappointing to
have such graphics bitmapped. Is there a trick (via maps?) to import a
vector graphic and have them plotted onto a graph? My searching attempts
in the searchable r-help archive did not seem to result in anything
useful...
Cheers,
hinrich