Hello all,
I want to construct "Two way Matrix". The Algorithm is like:
1) Data of time with censoring or events
2) Predictor variables (genes)
3) Resample original data in step 1 and 2 by WR
4) Apply Coxph Model to resample data. (Apply Surv function to each Predictor
variable, individually
Dear R-experts,
I'd like to avoid the use of very slow 'for'-loops but I don't know how.
My data look as follows (the original data has 1600 rows and 30 columns):
# data example
c1 <- c(1,1,1,0.25,0,1,1,1,0,1)
c2 <- c(0,0,1,1,0,1,0,1,0.5,1)
c3 <- c(0,1,1,1,0,0.75,1,1,0.5,0)
x <- data.frame(c1,
Here's a possible solution to avoid the loop
k <- as.matrix(expand.grid(1:ncol(x),1:ncol(x)))
a1 <- as.data.frame(matrix(sapply(1:nrow(k), function(n)
agree(x[,k[n,]])$value), nrow=ncol(x)))
colnames(a1) <- colnames(x)
rownames(a1) <- colnames(x)
> identical(a, a1)
[1] TRUE
Or if you want to avo
Hello,
You have three parameters, two sar and one intercept.
arima(x, order=c(0,0,0), seasonal=list(order=c(2,0,0), period=4),
transform.pars = FALSE, fixed = c(0.54, 0.5, rep(NA, 1)))
I also believe that the answer you got from Rolf is more to the point.
Try something along the lines
**
I am using the following way to get p-values from fiser exact test.
However, I do need to print for each pair the values "n00, n01, n10, n11".
How can I print that as a table and not a matrix as below along with the
p-value? Any help will be greatly appreciated
fish <- function(y, x) {n00 = s
H
ello R-experts,
I want to do ordination plots using vegan metaMDS.
I have a where many cells have zero values.
Data structure:
X[1:10,1:14]
Height.1 Height.2 Height.3 Height.4 Height.5 Height.6 Height.7
Height.8 Height.9 Height.10 Height.11 Height.12 Height.13
D30I1A 460
G'morning.
On Mon, Jun 24, 2013 at 2:22 AM, peter dalgaard wrote:
>
> On Jun 23, 2013, at 22:30 , Sarah Goslee wrote:
>
>> Hi,
>>
>> If you're doing exactly as described below, then you need to add the
>> data argument to wilcox.test so R knows where to find beforesmall and
>> aftersmall. But if
Hi,
What do you expect the dissimilarity between a site with no species
and a site with some species to be?
If you want to use Bray-Curtis dissimilarity, you need to drop the
sites with no species, as the error message suggests.
But if you can answer my first question, you may be able to select
Dear members.
I am having problems to understand the kmeans- results in R. I am applying
kmeans-algorithms to my big data file, and it is producing the results of
the clusters.
Q1) Does anybody knows how to find out in which cluster (I have fixed
numberofclusters = 5 ) which data have been used?
Hello,
I am looking for tolerance interval related methodologies and found the
package "tolerance" which will e.g. nicely calculate the 95%/95% tolerance
limits of a given regression. What I am looking for, however is not only the
the tolerance limits this calculation defines, but I would like
Are you saying that the dive data for a single whale with 8 dives is stored
in 8 separate files?
How are you reading these files into R? read.table()? Could you post an
example of the line of code that reads in the data?
Something like this might work for you.
# vector of file names
file.names
What was the line of code you submitted right before the error?
Jean
On Sat, Jun 22, 2013 at 12:36 AM, lay khoon wrote:
> Hi,
>
>I had been using a script that works fine for several days and then
> I stopped using it for a month without having doubt that it would not be
> working. Whe
You should read the help page
?kmeans
Especially the section labeled "Value" which tells you what kmeans
returns. You will see that the cluster membership is returned as a
vector of integers called "cluster." If you don't know how to access
that from kmeans.results, you haven't read any of the ba
Could you provide an example of mat1 and mat2 as well as an example of the
output you would like from them.
Your code is very difficult to follow as written. It will be easier for
readers of the list to interpret if you use carriage returns rather than
semi colons, for example ...
fish <- functi
Hi,
Thanks for reply but I already read the help page I am new in R and did not
understand the output description of kmeans -function. That is why I wanted
to ask some experts in the group.
My point is that I do not understand which data are combined in the specific
cluster?
I tried the following
On Jun 24, 2013, at 15:21 , Sarah Goslee wrote:
> G'morning.
>
> On Mon, Jun 24, 2013 at 2:22 AM, peter dalgaard wrote:
>>
>> On Jun 23, 2013, at 22:30 , Sarah Goslee wrote:
>>
>>> Hi,
>>>
>>> If you're doing exactly as described below, then you need to add the
>>> data argument to wilcox.te
Sample data is as follows (for simplicity assume mat1 and mat2 are the same
matrices). Also attached as an excel file.
I want to get the pairwise interaction fischer test results. Not just the
pvalues but also want to wrote the n00, n01, n10 and n11 in the file as:
ADCK2_mat1 ADCK3_mat2 n00 n01
Hi guys,
I'm a newby, so sorry for the easy question.
I have a matrix (459x28) in which a large number of observations are
repeated (same placed sampled in different times).
One of the columns is refers to the ID of the place of sampling.
What I would like is to extract subset matrix for every
On Jun 24, 2013, at 12:13 AM, Fazli Raziq wrote:
> Hello all,
>
> I want to construct "Two way Matrix". The Algorithm is like:
>
> 1) Data of time with censoring or events
> 2) Predictor variables (genes)
> 3) Resample original data in step 1 and 2 by WR
> 4) Apply Coxph Model to resample d
Dear Sarah,
Thanks for your reply. But I don't have any site where all the species
are 0. Is there anyway to calculate the dissimilarity between sites where
it computes only the non-zero species values. Excluding all the zero event
will result a big loss in species data. I don't want to delete th
the inconsolata miktex package (inconsolata-zi4 in CTAN) which contains the
font of the same name was recently updated. It now contains the file
zi4.sty instead of inconsolata.sty. When I was building an R package, the
help(or vignette) file pdf couldn't built , because R couldn't find
inconsolata
Hello,
Try the following.
result <- lapply(unique(dataset$ID), function(uid) dataset[dataset$ID ==
uid, ])
names(result) <- unique(dataset$ID)
Hope this helps,
Rui Barradas
Em 24-06-2013 15:36, matteo escreveu:
Hi guys,
I'm a newby, so sorry for the easy question.
I have a matrix (459x2
R users,
The deadline for submission of abstracts is *** TOMORROW *** (Tuesday, June
25).
Abstracts are now being accepted for the 2014 ASA Conference on Statistical
Practice, February 20-24, Tampa, Florida, USA. Each presentation will have
a 45-minute time slot.
Based on a survey of the 2013 a
On 24-06-2013, at 18:21, Sancar Adali wrote:
> the inconsolata miktex package (inconsolata-zi4 in CTAN) which contains the
> font of the same name was recently updated. It now contains the file
> zi4.sty instead of inconsolata.sty. When I was building an R package, the
> help(or vignette) file
Hi,
result <- lapply(unique(dataset$ID), function(uid) dataset[dataset$ID
== uid, ])
Ok, I have the element result as a list
names(result) <- unique(dataset$ID)
Nothing happens. I don't have any submatrix...
Matteo
__
R-help@r-project.org mailing
First of all, is your data structure a matrix or a data frame? They
are different!
Assuming the latter, a shorter version of Rui's answer that avoids
unique() and automatically takes care of names is:
result <- by(dataset, dataset$ID,I)
See ?by, ?tapply, and ?split
-- Bert
On Mon, Jun 24, 2013
Hello,
You don't have a sub-data.frame, what you have is a list, with each
element of that list a df. Try to see, for instance, result[[1]]. This
should be a data.frame corresponding to the first ID.
Rui Barradas
Em 24-06-2013 18:03, matteo escreveu:
Hi,
result <- lapply(unique(dataset$ID
Sorry for the blank message. The default behavior of the Mac Mail.app spell
checker has me confused.
On Jun 24, 2013, at 10:03 AM, matteo wrote:
> Hi,
>
>> result <- lapply(unique(dataset$ID), function(uid) dataset[dataset$ID ==
>> uid, ])
> Ok, I have the element result as a list
>
>> names(
Hello,
I had forgotten the much simpler solutions. The following should do it.
split(dataset, dataset$ID)
Rui Barradas
Em 24-06-2013 18:13, Bert Gunter escreveu:
First of all, is your data structure a matrix or a data frame? They
are different!
Assuming the latter, a shorter version of Rui'
On Jun 24, 2013, at 10:03 AM, matteo wrote:
> Hi,
>
>> result <- lapply(unique(dataset$ID), function(uid) dataset[dataset$ID ==
>> uid, ])
> Ok, I have the element result as a list
>
>> names(result) <- unique(dataset$ID)
> Nothing happens. I don't have any submatrix...
>
> Matteo
>
> _
Oh yes, that's even better!
-- Bert
On Mon, Jun 24, 2013 at 10:33 AM, Rui Barradas wrote:
> Hello,
>
> I had forgotten the much simpler solutions. The following should do it.
>
> split(dataset, dataset$ID)
>
>
> Rui Barradas
>
> Em 24-06-2013 18:13, Bert Gunter escreveu:
>>
>> First of all, is y
Hi,
Try this:
res1<-do.call(cbind,t(sapply(res,c))[,1]) #get the acf values only. Assuming
that is what you wanted.
write.csv(res1,"AMSacf.csv",row.names=FALSE)
A.K.
From: Zilefac Elvis
To: arun
Sent: Monday, June 24, 2013 1:00 PM
Subject: Re: [R] Apply
Inline below...
On Mon, Jun 24, 2013 at 11:31 AM, matteo wrote:
> First of all, thanks for all the replies!!
> What you have written helps, but is not entirely the answer to my problem.
>
> What I'd have is the creation of new data.frames each of one named with the
> ID of the original dataframe
First of all, thanks for all the replies!!
What you have written helps, but is not entirely the answer to my problem.
What I'd have is the creation of new data.frames each of one named with
the ID of the original dataframe and with all the columns.
For example, in the original dataframe one co
Hi,
On Mon, Jun 24, 2013 at 12:04 PM, Suparna Mitra
wrote:
> Dear Sarah,
> Thanks for your reply. But I don't have any site where all the species are
> 0.
Well, that's what this says:
> 1: In distfun(comm, method = distance, ...) :
> you have empty rows: their dissimilarities may be meaningl
When sharing data, use dput() to output the data in a way that R-Help
readers can easily use.
Give this code a try and see if it helps.
Jean
# read in the example data
mat1 <- structure(list("GENE SYMBOL" = c("ADCK2", "ADCK3", "ADCK4",
"ADCK5",
"ADRBK1", "ADRBK2", "AKT1", "AKT2", "AKT3", "ALK
> First of all, thanks for all the replies!!
> What you have written helps, but is not entirely the answer to my problem.
>
> What I'd have is the creation of new data.frames each of one named with
> the ID of the original dataframe and with all the columns.
What was suggested gave you a list of
Dear R-users,
I have used the nomogram function from the rms package for a logistic
regresison model made with lrm(). Everything works perfectly (r version
2.15.1 on a mac). My question is this: if my final model is not the one
created by lrm, but I internally validated the model and 'shrunk' the
Rui-- thanks so much for the help!
I'm getting this error though, which is leaving me stumped:
test<-lapply(ids, function(i) {
if(!any(is.na(df[df$ID==i,3]))) {adf.test(df[df$ID==i, 3])} else {NA}
})
Error in if (interpol == min(tablep)) warning("p-value smaller than
printed p-value")
On Mon, 2013-06-24 at 19:33 +0800, Suparna Mitra wrote:
> H
> ello R-experts,
> I want to do ordination plots using vegan metaMDS.
> I have a where many cells have zero values.
>
> I am having two different kind of errors for these two data...
> Error 1
> > ord1 <- metaMDS(
> X
> ="bray")
Th
Awesome! Thanks so much for your help. I am able to get the format I was
looking for.
On Mon, Jun 24, 2013 at 2:50 PM, Adams, Jean wrote:
> When sharing data, use dput() to output the data in a way that R-Help
> readers can easily use.
>
> Give this code a try and see if it helps.
>
> Jean
>
>
Hello,
From the help page for ?adf.test: "The p-values are interpolated from
Table 4.2, p. 103 of Banerjee et al. (1993)."
I believe it's a problem with your data. Putting a print statement in
the code for adf.test() gave me the following:
Call:
lm(formula = yt ~ xt1 + 1 + tt + yt1)
Resid
That makes a lot of sense. Thank you, Rui!
On Mon, Jun 24, 2013 at 3:41 PM, Rui Barradas wrote:
> Hello,
>
> From the help page for ?adf.test: "The p-values are interpolated from
> Table 4.2, p. 103 of Banerjee et al. (1993)."
>
> I believe it's a problem with your data. Putting a print stateme
According to
http://cran.r-project.org/doc/contrib/Fox-Companion/appendix-scope.pdf and
other examples online, I am to believe that R resolves variables using lexical
scoping by following the frames up the call stack. However, that's not working
for me. For example, the following code, taken
Hello,
The object 'a' exists if function f() not in the global environment
where g() is defined. R is in fact going up, but to the global
environment and not finding 'a'. Try, as an example, the following.
f <- function(x) {
g <- function(y) { y + a }
a <- 5
g(x)
}
On Mon, Jun 24, 2013 at 4:27 PM, David Kulp wrote:
> According to
> http://cran.r-project.org/doc/contrib/Fox-Companion/appendix-scope.pdf and
> other examples online, I am to believe that R resolves variables using
> lexical scoping by following the frames up the call stack. However, that's
f1<- function(x){env<- parent.frame();env$a<-5; g(x)}
f1(2)
#[1] 7
f1(7)
#[1] 12
f1(5)
#[1] 10
A.K.
From: David Kulp
To: "r-help@r-project.org"
Sent: Monday, June 24, 2013 4:27 PM
Subject: [R] Lexical scoping is not what I expect
According to
http://cr
I hope that Robert Gentleman is currently getting a thrill. :-)
[See fortune("lexical scoping").]
cheers,
Rolf Turner
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide htt
On Jun 24, 2013, at 3:27 PM, David Kulp wrote:
> According to
> http://cran.r-project.org/doc/contrib/Fox-Companion/appendix-scope.pdf and
> other examples online, I am to believe that R resolves variables using
> lexical scoping by following the frames up the call stack. However, that's
>
You are using an informal shrinkage method. It is much better to use
penalized maximum likelihood estimation, built in to lrm.
If you really want to go the informal route, compute the linear
predictor from your final estimates and use ols( ) to predict that from
the component variables (you'l
On Jun 24, 2013, at 12:00 PM, Sander van Kuijk wrote:
> Dear R-users,
>
> I have used the nomogram function from the rms package for a logistic
> regresison model made with lrm(). Everything works perfectly (r version
> 2.15.1 on a mac). My question is this: if my final model is not the one
> cr
Hello,
This might belong in the R-devel category, but I am not a C / C++
programmer, so I thought I'd start here. I have just written my first R
extension using Rcpp, and it is SO much faster than my best R efforts,
thank you for such a wonderful package! Instead of writing a separate text
file, I
Hello,I was trying to enter commands input messages or error within a
routin.for example : msg (consistency error: at the time ( j : generic time )
the lower quantile is not less than the upper quantile)
thanks in advanceFrancesco Miranda
[[alterna
Hi All:
Not sure why my previous question never got posted. Here I am seeking some
help on my code. I am using the following code to run MCMC simulation on
the following data using the model below:
# Data
matrix<-NULL
> csvs<-paste("MVN", 1:2,".csv",sep="")
> for (i in 1:length(csvs)){
+ matrix[[i
Hi Mollyy,
On 24 June 2013 at 14:53, Molly Davies wrote:
| Hello,
| This might belong in the R-devel category, but I am not a C / C++
| programmer, so I thought I'd start here. I have just written my first R
The convention is that package-specific question go to the package specific
forums. In t
It sounds like ?stop is what you're looking for.
Sarah
On Mon, Jun 24, 2013 at 4:50 PM, Francesco Miranda wrote:
> Hello,I was trying to enter commands input messages or error within a
> routin.for example : msg (consistency error: at the time ( j : generic time
> ) the lower quantile is not
On 13-06-24 4:27 PM, David Kulp wrote:
According to
http://cran.r-project.org/doc/contrib/Fox-Companion/appendix-scope.pdf and
other examples online, I am to believe that R resolves variables using lexical
scoping by following the frames up the call stack.
You appear to have misread it. Lex
Indeed, I misread / misunderstood. I think it's a difficult concept that's hard
to explain and the example wasn't great. But thanks all for straightening me
out!
â
David Kulp
On Mon, Jun 24, 2013 at 6:44 PM, Duncan Murdoch
wrote:
> On 13-06-24 4:27 PM, David Kulp wrote:
>> According to
>> h
> I think it's a difficult concept
If you pass non-global things via the argument list then you don't
have to think about scoping issues so much. E.g., instead of
f <- function(x) {
g <- function(y) { y + a }
a <- 5
g(x)
}
try
f <- function(x) { a <- 5 ; g(x, a) }
g
Dear R People:
Are there any packages for PERT or CPM analysis, please?
I checked the usual places, but did not see anything. I wanted to make
sure that such items do not exist before I start writing functions.
Thanks in advance,
Sincerely,
Erin
--
Erin Hodgess
Associate Professor
Department
Dear list,
I've searched the archives and tried some code, however would appreciate some
input - even a pointer in the direction of the correct function to use.
Given N samples each of which is measured for characteristics x1, x2, x3,... (m
6) where each characteristic is a roughly normally di
This may be a simple problem but I spent most of my day today trying to
figure it out, as I am not a programmer. I have a dataframe with
observations from different weeks of the year, numbered. My variable
"week" has values week1, week4, week9, etc. Not all weeks are represented.
I need to calculat
Hi Ion:
Here's something that might work for you
> flight.df <- read.table(file="clipboard",header=TRUE)
> by(flight.df$NoFlights,flight.df$Week,summary)
flight.df$Week: week1
Min. 1st Qu. MedianMean 3rd Qu.Max.
30.00 30.75 32.00 31.75 32.25 36.00
--
"... trying to figure it out" ??
Not sure what that means.Have you read "An Introduction to R."? If
not, do so now.
In any case, ?ave is made for what you want, I think (simpler than
?by). As in (if df is your data frame):
ave(df$NoFlights,df$Week, FUN= mean)
Or, better yet, using ?with and not
64 matches
Mail list logo