Displaying 20 results from an estimated 800 matches similar to: "Cleaning database: grep()? apply()?"
2012 Jan 22
4
undefined method `gsub!' for 2012-01-22 17:00:00 -0500..2012-01-23 00:00:00 -0500:Chronic::Span
Hey all,
I am getting this error:
NoMethodError (undefined method `gsub!'' for 2012-01-22 17:00:00
-0500..2012-01-23 00:00:00 -0500:Chronic::Span):
in this code:
date_range = Chronic.parse(the_date, :guess =>
false)
reports.sum_distance_by_date(date_range).each do |d|
u[:m] << d
end
def
2008 Jan 07
3
Polynomial fitting
I wonder how one in R can fit a 3rd degree polynomial to some data?
Say the data is:
y <- c(15.51, 12.44, 31.5, 21.5, 17.89, 27.09, 15.02, 13.43, 18.18, 11.32)
x <- seq(3.75, 6, 0.25)
And resulting degrees of polynomial are:
5.8007 -91.6339 472.1726 -774.2584
THanks in advance!
--
Jonas Malmros
Stockholm University
Stockholm, Sweden
2008 Jun 24
10
Question on passing arguments inside a view.
I''m running into an issue undefined local variable or method
`directoryid'' for #<EditorialsController:0x23f1bf8>
I have two Models on a legacy database and only one controller called
editorials with two actions index and display.
I''m trying to pass in a parameter from the results of my search and
getting the above error.
Example:
two tables one is editorial the
2009 Nov 08
3
MCMC gradually slows down
Hello,
I have written a simple Metropolis-Hastings MCMC algorithm for a
binomial parameter:
MHastings = function(n,p0,d){
theta = c()
theta[1] = p0
t =1
while(t<=n){
phi = log(theta[t]/(1-theta[t]))
phisim = phi + rnorm(1,0,d)
thetasim = exp(phisim)/(1+exp(phisim))
r = (thetasim)^4*(1-thetasim)^8/(theta[t]^4*(1-theta[t])^8)
if(runif(1,0,1)<r){
theta[t+1] = thetasim
}
2008 Mar 19
3
How to remove double for loop?
Hello everyone.
I use double for loops to fill in matrices, but there are surely
better (and computationally faster) ways to perform that task.
Could someone show me, given the following example of a double for
loop, how this could be done? It is much easier to learn by examples.
Val <- matrix(0, nrow=n+1, ncol=n+1)
for( i in 0:n){
for(j in 0:i){
Val[j+1, i+1] <- u^j*d^(i-j)
2007 Dec 17
3
Cannot grasp how to apply "by" here...
I have a data frame named "database" with panel data, a little piece
of which looks like this:
Symbol Name Trial Factor1 Factor2
External
1 548140 A 1 -3.87
-0.32 0.01
2 547400 B 1 12.11
-0.68 0.40
3 547173 C 1
2004 Mar 19
2
Moving to 1.8.1: can you transfer your package list?
I prefer to use R on a linux box and ultimately need things to end up
there to serve things up using David Firth's excellent CGIwithR and
apache, but one step at a time and I've installed 1.8.1 under win2k.
Another question that I'm sure is simple: is there a simple way to
find the list of installed libraries I had in my 1.7.1 installation
and use that to drive install.packages?
2005 Feb 10
5
sample
I am trying to sample a subset from a matrix using sample.
The size of the matrix is 20X 1532. It works fine with this,
but when I transpose the matrix and try to sample it, it returns
null.
pick.set<-sample(tissue.exp.t,5,replace=FALSE,prob=NULL)
Is there something that I am missing here ?
Thanks ../Murli
2008 Mar 19
3
How to remove double loop?
Bill, Alberto, Gabor,
Thank you for answering my question. Now I learned about outer() function.
That was a straightforward example.
But what if I had a matrix, where the last column was filled with
values first (again, a for loop), and the rest was filled by using a
double loop?
OVal <- matrix(0, n+1, n+1)
for(i in 0:n){
OVal[i+1, n+1] <- max(Val[i+1, n+1]-K, 0)
}
for(i in seq(n,1,
2008 Sep 14
2
Help please! How to code a mixed-model with 2 within-subject factors using lme or lmer?
Hello,
I'm using aov() to analyse changes in brain volume between males and
females. For every subject (there are 331 in total) I have 8 volume
measurements (4 different brain lobes and 2 different tissues
(grey/white matter)). The data looks like this:
Subject Sex Lobe Tissue Volume
subect1 1 F g 262374
subect1 1 F w 173758
subect1 1 O g 67155
subect1 1 O w 30067
subect1 1 P g 117981
2007 Feb 14
1
nested model: lme, aov and LSMeans
I'm working with a nested model (mixed).
I have four factors: Patients, Tissue, sex, and tissue_stage.
Totally I have 10 patients, for each patient, there are 2 tissues
(Cancer vs. Normal).
I think Tissue and sex are fixed. Patient is nested in sex,Tissue is
nested in patient, and tissue_stage is nested in Tissue.
I tried aov and lme as the following,
> aov(gene ~ tissue + gender +
2011 Sep 20
1
A question regarding random effects in 'aov' function
Hi,
I am doing an analysis to see if these is tissue specific effects on the
gene expression data .
Our data were collected from 6 different labs (batch effects). lab 1 has
tissue type 1 and tissue type 2, lab 2 has tissue 3, 4,5,6. The other labs
has one tissue type each. The 'sample' data is as below:
2008 Sep 13
2
moving from aov() to lmer()
Hello,
I've used this command to analyse changes in brain volume:
mod1<-aov(Volume~Sex*Lobe*Tissue+Error(Subject/(Lobe*Tissue)),data.vslt)
I'm comparing males/females. For every subject I have 8 volume measurements
(4 different brain lobes and 2 different tissues (grey/white matter)).
As aov() provides only type I anovas, I would like to use lmer() with type
II, however, I have
2010 Apr 23
2
Problem with parsing a dataset - help earnestly sought
Dear fellow R-help members,
I hope to seek your advice on how to parse/manage a dataset with hundreds of
columns. Two examples of these columns, 'cancer.problems', and
'neuro.problems' are depicted below. Essentially, I need to parse this into
a useful dataset, and unfortunately, I am not familiar with perl or any such
language.
data <- data.frame(id=c(1:10))
2011 Oct 30
1
Normality tests on groups of rows in a data frame, grouped based on content in other columns
Dear R users,
I have a data frame in the form below, on which I would like to make normality tests on the values in the ExpressionLevel column.
> head(df)
ID Plant Tissue Gene ExpressionLevel
1 1 p1 t1 g1 366.53
2 2 p1 t1 g2 0.57
3 3 p1 t1 g3 11.81
4 4 p1 t2 g1 498.43
5 5 p1 t2 g2 2.14
6 6 p1 t2 g3 7.85
I
2007 Oct 27
3
How to make own function load automatically on startup
Dear list members,
I have written a function, called say Analysis. I supply an Excel file
name as an argument, it does analysis on this file and returns a pdf
file with specific plots, and a text file with several statistical
models' output (I extract certain values from the output and create my
own custom dataframe with output).
As of now I have to open the script file and load the function
2010 Nov 25
1
difficulty setting the random = argument to lme()
My small brain is having trouble getting to grips with lme()
I wonder if anyone can help me correctly set the random = argument
to lme() for this kind of setup with (I think) 9 variance/covariance
components ...
Study.1 Study.2 ...
Study.10
Treatment.A: subject: 1 2 3 4 5 6 etc. 28 29 30
Treatment.B: subject: 31
2011 Aug 26
2
how to convert Date to this json format
Hi
I have to create a json date like
{"startDate":"\/Date(1291145744713-0700)\/","endDate":"\/Date(1293824144713-0700)\/"}
This is just an example.
My case startdate = Time.now-2.day
enddate = Time.now
I dont know how to convert this to the above format. Please help
Thanks
--
Posted via http://www.ruby-forum.com/.
--
You
2007 Jun 05
1
Can I treat subject as fixed effect in linear model
Hi,
There are 20 subjects grouped by Gender, each subject has 2 tissues
(normal vs. cancer).
In fact, it is a 2-way anova (factors: Gender and tissue) with tissue
nested in subject. I've tried the following:
Model 1: lme(response ~ tissue*Gender, random = ~1|subject)
Model 2: response ~ tissue*Gender + subject
Model 3: response ~ tissue*Gender
It seems like Model 1 is the correct one
2010 Nov 02
2
multi-level cox ph with time-dependent covariates
Dear all,
I would like to know if it is possible to fit in R a Cox ph model with
time-dependent covariates and to account for hierarchical effects at
the same time. Additionally, I'd like also to know if it would be
possible to perform any feature selection on this model fit.
I have a data set that is composed by multiple marker measurements
(and hundreds of covariates) at different time