Displaying 20 results from an estimated 48 matches for "calmette".
2006 Jul 06
2
questions on data management
Dear friends,
suppose i have two datasets: A and B
A:
id<-1:6
x<-c(1,2,3,4,5,6)
y<-c(2,4,6,8,3,2)
xy<-data.frame(id,x,y)
B
m<-c(1,1,3,3,5,5)
n<-c(2,2,6,6,3,3)
mn<-data.frame(m,n)
Now, i want to perfomr two tasks:
1. get a subset of B,no duplicate values,:
C:
m n
1 2
3 6
5 3
2.Extract the values in A on the conditions that x=m and y=n
the results should be:
id x y
1 1 2
3
2006 Jul 18
2
A contingency table of counts by case
Here is an example of the data.frame that I have,
df<-data.frame("case"=rep(1:5,each=9),"id"=rep(1:9,times=5),"x"=round(runif(length(rep(1:5,each=9)))))
"case" represents the cases,
"id" the persons, and
"x" is the binary state.
I would like to know in how many cases any two persons
a. both have "1",
b. the first has
2006 Sep 26
2
Vectorise a for loop?
Hi R guru coders
I wrote a bit of code to add a new column onto a "topTable" dataframe.
That is a list of genes processed using the limma package. I used a for
loop but I kept feeling there was a better way using a more vector
oriented approach. I looked at several commands such as "apply", "by"
etc but could not find a good way to do it. I have this feeling there
2006 May 03
1
Breaking a matrix into parts
Hi,
I've a matrix in 20*11 order. There are 11 variables,
i.e 11 columns and each variable have 20 row data. Now
i want to calculate covariance between any variable
with others taking 4 rows at a time, so that there
will be 5 blocks. How can i do this using any
R-function? If i want to do it in any 'loop' function?
Thanks a lot,
SB.
2006 May 03
3
Giving Error
I tried your code, but it's giving the following
error..
Error in match.fun(FUN) : argument "FUN" is missing,
with no default
2006 May 11
2
Break Matrix
Hi All,
I have a (331*12) matrix. I wan t to braek it into 28 parts each window having 12 rows, so that each matrix become (12*12) matrix. How can i do this.
Thanks,
Sumanta.
---------------------------------
Send instant messages to your online friends - NOW
[[alternative HTML version deleted]]
2006 May 18
1
Function (x) as consecutive values
Hi - I'm trying to avoid using a 'for' loop due to inefficiency and instead use a function (and ultimately tapply as I'm working on a matrix) but I can't figure out how to get 'function' to take the variables as anything other than vectors for example
aa<-0
x<-1:4
test.fun<-function(x)
{aa<-(x*x +aa)
return(aa)}
test.fun(1:4)
This code
2006 Jun 06
2
SPSS variable lables import
Hi,
I try to get the variable labels of a SPSS data file into R but don't
find this mentioned in the help file for foreign. Is there another way
to get them ?
BTW: An SPSS variable name is like: VAR001, whereas the variable label
might be 'Identification no.'
Thanks in advance,
F. Thomas
--
..........................................
Dr. Frank Thomas
FTR Internet Research
93110
2006 Jun 13
1
plotting gaussian data
Ok I guess it's time to ask.
So I want to plot my data. It's my data from a frequency table, "temp". My
formula is just a Gaussian eq. I have done the nls function to get my
parameters and now I want to do the whole plot (...) and then lines(..)
This is what I have done.
> temp
bin x
1 -4.0 0
2 -3.9 0
3 -3.8 0
4 -3.7 0
5 -3.6 0
6 -3.5 0 .... and so
2006 Aug 02
1
questions on aggregate data
Dear friends,
my question is how to aggregate dataset and the inverse manipulation.
e.g.My dataset
data structure1:
x
1
1
2
3
3
data structure2:
x freq
1 2
2 1
3 2
Then how to generate dataset2 from dataset1 and generate dataset1 from
dataset2?
e.g. dataset2 from dataset1 :
x<-c(1,1,2,3,3)
a<-tab(x)
as.data.frame(a)
*But i can't do the inverse manipulation:generate dataset1 from
2006 Aug 02
2
missing value
Hi all
# I have this data set and how can I assign NA?s in just one command ?
And why the summary(dat) function preserves the value 9 as real. ?
x <- c(1,2,3,9,4)
y <- c(3,6,9,2,3)
z <- c(9,9,2,2,8)
w <- c(6,5,3,0,9)
dat <- cbind(x,y,z,w)
summary(dat)
x[x==9] <- NA
y[y==9] <- NA
z[z==9] <- NA
w[w==9] <- NA
summary(dat)
summary(x)
summary(y)
summary(z)
summary(w)
2006 Aug 09
1
Combinations question
I need to generate a {0,1} matrix wifht nCr rows and n columns. The rows of the matrix will consist of all possible combinations containing r ones.
My clumsy attempt for n = 6 and r = 3 is
X <- expand.grid(c(1,0),c(1,0),c(1,0),c(1,0),c(1,0),c(1,0))
Y <- X[rowSums(X)==3,]
I can genralize this in a function but the result is quite ugly. Any suggestions?
Thank you in advance.
Martin
2006 Aug 29
1
First elements of a list.
Suppose I have the following list:
a <- strsplit(c("John;Smith", "Jane;Doe", "koda", "gunner"), ";")
I want to get to these two vectors without looping...
firstNames: c("John", "Jane", "koda", "gunner")
lastNames: c("Jane", "Doe", NA, NA)
Thanks
cn
[[alternative HTML
2006 Nov 24
1
barplot help needed
hello,
I would like to create the following barplot:
I have 4 different data sets (same length + stddev for each data point)
data1
sd1
data2
sd2
data3
sd3
data4
sd4
now, I'd like to plot in the following way:
data1[1],data2[1],data3[1],data4[1] with it's sd-values side-by-side at
one x-axis label (named "position 1") and each bar in different colors.
2006 Nov 24
1
Error Message saying .Call("R_lazyLoadDBfetch", etc.
...nder whether it might or not be a problem of memory size.
Could you please give me any suggestion on how to interpret this message?
Thanks in advance,
jacques
-------------------------------------------------------------------
Jacques VESLOT
CNRS UMR 8090
I.B.L (2?me ?tage)
1 rue du Professeur Calmette
B.P. 245
59019 Lille Cedex
Tel : 33 (0)3.20.87.10.44
Fax : 33 (0)3.20.87.10.31
http://www-good.ibl.fr
2006 Dec 19
2
how to replace some objects?
I want to replace some objects in one row or column.For example,
One colume: a,b,a,c,b,b,a,a,c.
I want to replace "a" with "1", "b" with "2", and "c" with "3".
Like this: 1,2,1,3,2,2,1,1,3.
How to do it? I donot know how to do it. Thanks.
[[alternative HTML version deleted]]
2006 Jul 10
1
How to include NA's of a factor in table?
Dear All,
Is there a better way to include NA's of a factor in the output of table()
than using as.character()?
Admittedly, I do not understand the help page for table concerning the
exclude argument applied to factors. I tried in different ways, but could
not get NA to be included in the table, if not using as.character() (see
example).
Greetings,
Heinz
## example
fcv <-
2006 Jul 11
1
Table of P values for Fisher's exact test
Hi,
I have a table of observed counts for various genetic markers. Instead of
doing Fisher's exact test for each marker one at a time and recording the P
value manually, is there a script to go through the whole list and generate
the P value column automatically?
An example of my data:
Counts_CHB and Counts_AA are the observed counts for one allele.
2N_CHB and 2N_AA are the total number
2006 Jul 13
2
simple question about variables....
Dear R users,
I have a simple question on variable manipulation.
Imagine I have an object "OBJ" that has "toto" as one of its variables.
I would like to understand why if I do
> varname <- "toto"
>OBJ$varname returns no results
whereas
> OBJ[varname] returns the column entitled
2006 Jul 13
1
Problems plotting a function defined as a product
In order to define a function f as:
> f <- function(x) (x+1)*(x+2)
I want to use the notation:
> v = c(1,2)
> g <- function(x) prod((v+x))
That apparently works and, for instance,
the loop:
>for (i in 1:100) { print(f(i)-g(i)) }
Produces a sequence of zeros.
Nevertheless, if I try to plot
the function g by:
>t = seq(0,100,1)
>plot(t,g(t),type="l")
I