Displaying 20 results from an estimated 2000 matches similar to: "function using values separated by a comma"
2010 May 02
2
Replace query
Hi,
I'm trying to replace all values equal to 1 in one file (a) with the value
in the corresponding column in a separate file (b). Example below.
Any help (and brief notes if poss) much appreciated. Thanks!!
file a:
0,0,1,1,0
1,0,0,0,1
0,0,0,0,0
1,0,1,1,0
file b:
3,4,6,8,11
output request:
0,0,6,8,0
3,0,0,0,11
0,0,0,0,0
3,0,6,8,0
--
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
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 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
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
2012 Jul 02
4
R sub query
Hello,
I would like to substitute a substring of characters defined by a specific start and end sequence.
i.e. in the example matrix below, I would like to substitute ".:X:" with "", where X varies in sequence...
m<-matrix(c(".:0:0,0", ".:2:0,2", ".:194:193,1", ".:56:0,56", ".:58:50,8", ".:13:0,13",
2008 Nov 02
5
R newbie: how to replace string/regular expression
Hello;
I am a R newbie and would like to know correct and efficient method for
doing string replacement.
I have a large data set, where I want to replace character "M", "b",
and "K" (currency in Million, Billion and K) to millions. That is
209.7B with (209.7 * 10e6) and 100.00K with (100.00 *1/100)
and etc..
d <- c("120.0M", "11.01m",
2010 Apr 16
3
VERY SIMPLE QUESTION
Dear R users,
I am looking for more efficient way to compute the followings
--------------------------------------------------------------------------
a <- matrix(c(1,1,1,1,2,2,2,2),4,2)
b <- matrix(c(1,2,3,4),4,1)
Eventually, I want to get this matrix, `c`.
c <- matrix(c(1/1,1/2,1/3,1/4,2/1,2/2,2/3,2/4),4,2)
--------------------------------------------------------------------------
2012 Oct 22
4
¿Problemas al cargar slqdf sobre Windows....?
Hola,
Estoy intentando cargar la librería "sqldf" y obtengo este error:
> library(sqldf)
Loading required package: gsubfn
Error : .onLoad failed in loadNamespace() for ''gsubfn'', details:
call: get(name, envir = asNamespace(pkg), inherits = FALSE)
error: objeto ''addVigs2WinMenu'' no encontrado
Error: package ‘gsubfn’ could not be loaded
La
2013 Dec 17
3
In-string variable/symbol substitution: What formats/syntax is out there?
Hi,
I'm try to collect a list of methods/packages available in R for doing
in-string variable/symbol substitution, e.g. someFcn("pi=${pi}"),
anotherFcn("pi=@pi@") and so on becomes "pi=3.141593". I am aware of
the following:
** gsubfn() in the 'gsubfn' package, e.g.
> gsubfn( , , "pi = $pi, 2pi = `2*pi`")
[1] "pi = 3.14159265358979,
2009 Dec 01
2
Cut intervals (character) to numeric midpoint; regex problem
Starting with the head of a 499 element matrix whose column names are
now the labels trom a cut() operation, I needed to get to a vector of
midpoints to serve as the basis for plotting a calibration curve
( exp(linear predictor) vs. :
> dput(head(dimnames(mtcal)[2][[1]])) # was starting point
testvec <- c("(-8.616,-3.084]", "(-3.084,-2.876]",
2009 Apr 13
3
toupper does not work in sub + regex
Hi, I don't know what I am doing wrong to the toupper does not seem
working in sub + regex. The following returns 's' not the upper class
'S' as I expect:
sub("q_([a-z])[a-zA-Z]*",toupper('\\1'),"q_sviRaw")
Can someone tell me where I did wrong?
Thanks,
Richard
[[alternative HTML version deleted]]
2011 Oct 19
4
Using SQL "IN" with RJDBC or RMySQL
Hello,
The code below works fine up until I try to use the "IN" statement in
the last line. The proper SQL format is:
SELECT * FROM this_table WHERE this_column IN (1,2,3,4,5)
But, I think I may be getting something like:
SELECT * FROM this_table WHERE this_column IN c(1,2,3,4,5)
Which makes no sense in SQL. I think it may be just a matter of string
massaging, but I'm not
2012 Aug 24
1
Error while installing gsubfn_0.6-4.tar.gz for R 2.15.1
Hi,
I am getting the follwoing error while installing gsubfn_0.6-4.tar.gz library for R. R version is 2.15.1 and i am installing on Redhat linux version 2.6.18-238.9.1.el5 (mockbuild at x86-002.build.bos.redhat.com<mailto:mockbuild at x86-002.build.bos.redhat.com>) (gcc version 4.1.2 20080704 (Red Hat 4.1.2-50))
* installing to library ?/home/mapred/installables/R/library?
* installing
2007 Sep 07
2
Automatic detachment of dependent packages
Dear All,
When one loads certain packages, some other dependent packages are
loaded as well. Is there some way of detaching them automatically when
one detaches the first package loaded? For instance,
> library(sqldf)
Loading required package: RSQLite
Loading required package: DBI
Loading required package: gsubfn
Loading required package: proto
but
> detach(package:sqldf)
>
>
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 Mar 15
2
tcltk and R
I have had some comments on sqldf regarding its dependence on tcltk
such as the second last sentence on this blog post:
http://translate.google.com/translate?hl=en&sl=zh-CN&u=http://www.wentrue.net/blog/%3Fp%3D453&prev=http://blogsearch.google.com/blogsearch%3Fhl%3Den%26ie%3DUTF-8%26q%3Dsqldf%26lr%3D%26sa%3DN%26start%3D10
sqldf does not directly use tcltk but it does use strapply in
2008 Jun 14
2
strsplit, keeping delimiters
Hi all,
Does anyone have a version of strsplit that keeps the string that is
split by. e.g. from
x <- "A: 123 B: 456 C: 678"
I'd like to get
c("A:", "123 ", "B: ", "456 ", "C: ", 678)
but
strsplit(x, "[A-Z]+:")
gives me
c("", " 123 ", " 456 ", " 678")
Any ideas?
Thanks,