Displaying 20 results from an estimated 300 matches similar to: "Replace query"
2010 Oct 08
4
function using values separated by a comma
Hello,
I have a dataframe (tab separated file) which looks like the example below -
two values separated by a comma, and tab separation between each of these.
[,1] [,2] [,3] [ ,4]
[1,] 0,1 1,3 40,10 0,0
[2,] 20,5 4,2 10,40 10,0
[3,] 0,11 1,2 120,10 0,0
I would like to calculate the percentage of the smallest number separated by
the comma by:
1) summing the values e.g. for
2010 Apr 09
3
How to replace all non-maximum values in a row with 0
Hi,
I would like to replace all the max values per row with "1" and all other
values with "0". If there are two max values, then "0" for both. Example:
from:
2 3 0 0 200
30 0 0 2 50
0 0 3 0 0
0 0 8 8 0
to:
0 0 0 0 1
0 0 0 0 1
0 0 1 0 0
0 0 0 0 0
Thanks!
--
View this message in context:
2010 Apr 27
2
Histogram not plotting correct breaks
Hi,
I'm using the hist function to plot the frequency of 21 variables, but it
keeps starting the x-axis from 0 and adding variables 1 and 2 together (all
other vairables have the correct frequencies). I suspect it adds 1 and 2
together so that 0 can fit in with demarcations at intervals of 5. Using
"xlim=c(1,21)" to specify that i don't want to include 0 and using the
2009 Feb 18
2
Tables
Are there any standards emerging for how to represent tables in Markdown?
Regards,
- Daniel
--------------------------------------------
Dr Daniel Winterstein
Winterwell Associates Ltd
tel: 0772 5172 612
http://www.winterwell.com
Registered in Scotland, company no. SC342991
2012 Jun 19
2
Thinking Sphinx Problem
Hi,
I am using *Thinking Sphinx version 2.0.11 *in one of my project. To create
an index I ran* **rake thinking_sphinx:index *and I got the following error
Generating Configuration to /home/saidev/Ubuntu
One/burgundy/ssearch/config/development.sphinx.conf
rake aborted!
At least one field is necessary for an index
Tasks: TOP => thinking_sphinx:index
(See full trace by running task with
2010 Oct 12
1
Comparison of two files with multiple arguments
Hello,
I have an example file which can be generated using:
dat <- read.table(tc <- textConnection(
'T T,G G T
C NA G G
A,T A A NA'), sep="")
I also have a reference file with the same number of rows, for example:
G
C
A
I would like to transform the file to numerical values using the following
arguments:
1) Where data points have two letters separated by a comma, e.g.
2010 Apr 30
1
How to generate a distance matrix?
Hi,
I'm trying to generate a distance matrix between sample pairs (example
below). I'm not very familiar with the loop command which I expect I will
need for this. The example below demosntrates what I'd like to get out of
the data - essentially, to calculate the proportion of positions where two
samples differ.
Any help much appreciated! Also, any notes on how the functions work
2008 Mar 14
3
write function (PR#10953)
Full_Name: Alexander Yephremov
Version: R 2.6.2 GUI 1.23 (4932) (4932)
OS: Mac OS X 10.4
Submission from: (NULL) (193.174.239.91)
Hi!
> array <- 0*1:50
> array
[1] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0
> write(array, "array.file", sep=",")
This is how array.file looks:
0,0,0,0,0
0,0,0,0,0
0,0,0,0,0
2010 Mar 02
1
how to import map data (maptools?) from a html set of 'coords'
Dear R users,
I would like to draw map and import it in maptools/spatstat packages.
The 'raw data' I have come from a web page (<map>...</map>) and are
basically a list of coordinates of a polygon.
I would like to know how to import them in R; I checked the maptools
packages, but all the examples use existing .dbf files.
I just have a (serie of) text file(s) looking like
2010 Apr 25
1
How to assign scores to rows based on column values
Hi,
I'm trying to assign a score to each row which allow me to identify which
rows differ. In the example file below, I've used "," to indicate column
separators. In this example, I'd like to identify that row 1 and row 5 are
the same, and row 2 and row 4 are teh same.
Any help much appreciated. Also, any comments on what the command lines do
would be fantastic.
Thanks!!
2003 May 19
1
survit function and cox model with frailty
Hi:
I have a question about the use of the survfit function after the
estimation of a cox proportional hazard model with a frailty term. My goal
is to estimate expected survival probabilities while controlling for the
group-specific frailty term.
First, I estimate a model of the following form:
model1 <- coxph(Surv(t0, t, d) ~ x1 + x2 + frailty(id), na.action=na.exclude,
2007 Nov 06
1
color2D.matplot
I am a true R novice aonly using it for this function ;)
I am trying to use color2D.matplot to form a image of my data using the
following conditions
color2D.matplot(fi1, c(dr), c(dg), c(db), nslices=7, ylab='Species',
xlab="gene", show.legend=TRUE) where fi1 is my matrix.
I have a matrix with 36 columns and 130 rows. most entries are 1 or 0 and I
am trying to get this
2005 May 31
1
GLM question
I am unfamiliar with R and I’m trying to do few statistical things like GLM and GAM with it. I hope my following questions will be clear enough:
My datas ( y(i,j ))are run off triangles for example :
J=1
J=2
J=3
I=1
1
2
3
I=2
4
5
I=3
6
My model is :
E[y(i,j)] =m(i,j)
Var[y(i,j)] =constant *m(i,j)
Log(m(i,j)) = eta (i,j)
eta (i,j) = c + alpha(i)
2012 Aug 02
1
Naive Bayes in R
I'm developing a naive bayes in R. I have the following data and am trying
to predict on returned (class).
dat = data.frame(home=c(0,1,1,0,0), gender=c("M","M","F","M","F"),
returned=c(0,0,1,1,0))
str(dat)
dat$home <- as.factor(dat$home)
dat$returned <- as.factor(dat$returned)
library(e1071)
m <- naiveBayes(returned ~ ., dat)
m
2009 Jun 14
3
if + is.na
Hello!
I wont to use a function is.na()
I have two vectors:
> a=c(1,NA,3,3,3)
> b=c(0,0,0,0,0)
and when I use is.na function it's ok:
> is.na(a)
[1] FALSE TRUE FALSE FALSE FALSE
but I would create sth like this:
for i in 1:length(a){
if (wsp[i] == is.na(a)) {b=43}
}
or like this
if(is.na(a)) b=3 else a
[1] 1 NA 3 3 3
but I always get an error:
the condition has
2010 Jun 20
3
Spatial: number of independent components?
Hi all, I am sorry if this is a very basic quesion, but I have no experience
with analyzing spatial data and could not find the right function/package
quickly. Any hints would be much appreciated. I have a matrix of spatial
point patterns like the one below and want to find the number of independent
components (if that's the right term) in that matrix (or in that image).
x=matrix(c(0,1,0,0,0,
2012 Apr 13
1
Coding columns for survival analysis
Hello Folks,
I have 5 columns for thousands of tree records that record whether that
tree was alive or dead. I want to recode the columns such that the cell
reads "found" when a live tree is first observed, "alive" for when a
tree is found alive and is not just found, and "mort" when it was
previously alive but is now dead.
Given the following:
> tree_live
2013 Oct 20
5
nlminb() - how do I constrain the parameter vector properly?
Greets,
I'm trying to use nlminb() to estimate the parameters of a bivariate normal sample and during one of the iterations it passes a parameter vector to the likelihood function resulting in an invalid covariance matrix that causes dmvnorm() to throw an error. Thus, it seems I need to somehow communicate to nlminb() that the final three parameters in my parameter vector are used to
2010 Jul 05
3
selection of optim parameters
Hi all,
I am trying to rebuild the results of a study using a different data
set. I'm using about 450 observations. The code I've written seems to
work well, but I have some troubles minimizing the negative of the
LogLikelyhood function using 5 free parameters.
As starting values I am using the result of the paper I am rebuiling.
The system.time of the calculation of the function is
2009 Feb 27
3
rounding problem
hi i am creating some variables from same data, but somewhere is different
rouding.
look:
P = abs(fft(d.zlato)/480)^2
hladane= sort(P,decreasing=T)[1:10]/480
pozicia=c(0,0,0,0,0)
for (j in 1:5){ for (i in 2:239){
if (P[i]/480==hladane[2*j-1]){pozicia[j]=i-1}}}
period=479/pozicia
> P[2]/334
[1] 0.0001279107
> hladane[1]
[1] 0.0001279107
> P[2]/334==hladane[1]
[1]