Displaying 20 results from an estimated 20000 matches similar to: "Comparison of two files with multiple arguments"
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 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
2012 Jun 22
4
Search list of elements for a specific pattern
Hi,
I have a list of mutations, called "mutList", of the form:
> head(mutList)
Alu
1 AluJ
2 AluJ/F(R)AM
3 AluJ/FLAM
4 AluJ/FRAM
5 AluJ/monomer
6 AluJb
It contains about 500 elements and not all of them contain the
sequence "Alu". I tried using this code:
Alu<-mutList[which(grep("Alu",mutList)==1)]
But that simply returned
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:
2012 Oct 18
4
speeding read.table
R 2.15.1
OS X
Colleagues,
I am reading a 1 GB file into R using read.table. The file consists of 100 tables, each of which is headed by two lines of characters.
The first of these lines is:
TABLE NO. 1
The second is a list of column headers.
For example:
TABLE NO. 1
COL1 COL2 COL3 COL4 COL5 COL6 COL7 COL8 COL9 COL10
2012 Sep 28
3
Better way of Grouping?
Hello R users,
This is more of a convenience question that I hope others might find useful
if there is a better answer. I work with large datasets that requires
multiple parsing stages for different analysis. For example, compare group
3 vs. group 4. A more complicated comparison would be time B in group 3 of
group L with B in group 4 of group L. I normally subset each group with
the
2012 Dec 17
7
split character line into rows
Hey R users,
suppose we have data:
[1] 2010.12.26 00:00:52 688,88 11,69 43,00
[2] 11,69 43,00
[3] 11,69 43,00
[4] 11,69 43,00
[5] 11,69 43,00
[6] 11,69 43,00
[7] 11,69 43,00
[8] 11,69 43,00
[9] 11,69 43,00
[10] 11,69 43,00
[11] 11,69 43,00
[12] 11,69 43,00
[13] 11,69 43,00
[14] 11,69 43,00
[15] 11,69
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
2023 Jan 14
1
Removing variables from data frame with a wile card
You rang sir?
library(tidyverse)
xx = 1:10
yr1 = yr2 = yr3 = rnorm(10)
dat1 <- data.frame(xx , yr1, yr2, y3)
dat1 %>% select(!starts_with("yr"))
or for something a bit more exotic as I have been trying to learn a bit
about the "data.table package
library(data.table)
xx = 1:10
yr1 = yr2 = yr3 = rnorm(10)
dat2 <- data.table(xx , yr1, yr2, yr3)
dat2[, !names(dat2)
2012 Jul 12
3
plot graph by first letter
Hi all, may i know is it possible to plot a graph by first letter?
for example:
Name: Age:
Angel 20
Amelia 20
Bernard 19
Stephanie 20
Vanessa 22
Angeline 23
Camel 21
If I want to plot the name started with letter 'A' and their Angel,
2008 Mar 25
2
Compare two data sets
I would like to compare two data sets saved as text files (example below) to determine if both sets are identical(or if dat2 is missing information that is included in dat1) and if they are not identical list what information is different between the two sets(ie output "a1", "a3" as the differing information). The overall purpose would be to remove "a1" and
2010 Feb 14
2
xyplot, overlay two variables on one plot with group factors
All
I want to overlay two variables on the same plot following their appropriate
grouping. I have attempted to use subscripting in panel with panel.xyplot,
but I can't get the grouping to follow into the panel...here is an
example...
dat<-data.frame(
y= log(1:10),
y2=10:19,
x=1:10,
grp = as.factor(1)
)
dat2<-data.frame(
y= log(10:19),
y2= 20:29,
x=1:10,
grp = as.factor(c(2))
)
2023 Jan 14
3
Removing variables from data frame with a wile card
Steven,
Just want to add a few things to what people wrote.
In base R, the methods mentioned will let you make a copy of your original DF that is missing the items you are selecting that match your pattern.
That is fine.
For some purposes, you want to keep the original data.frame and remove a column within it. You can do that in several ways but the simplest is something where you sat the
2006 May 09
2
post hoc comparison in repeated measure
Hi, I have a simple dataset with repeated measures.
one factor is treatment with 3 levels (treatment1,
treatment2 and control), the other factor is time (15
time points). Each treatment group has 10 subjects
with each followed up at each time points, the
response variable is numeric, serum protein amount. So
the between subject factor is treatment, and the
within subject factor is time. I ran a
2009 Nov 21
3
"subset" or "condition" as argument to a function
Dear Rxperts!
I was wondering if it is possible to write a function which can take in
argument of a subset or condition.. Of course, I am aware of the alternate
methods like coplot, par.plot, xyplot etc... I am specifically interested in
using conditions/subsets with "plot"..
A simple fragmented example is shown here..
pltit <- function(y,x,dat,dat1,dat2,sbst) {
plot(y~x, data=dat,
2010 Oct 15
7
Problem with merging two zoo objects
Dear all, I have following 2 zoo objects. However when I try to merge those 2 objects into one, nothing is coming as intended. Please see below the objects as well as the merged object:
> dat11
V2 V3 V4 V5
2010-10-15 13:43:54 73.8 73.8 73.8 73.8
2010-10-15 13:44:15 73.8 73.8 73.8 73.8
2010-10-15 13:45:51 73.8 73.8 73.8 73.8
2010-10-15 13:46:21 73.8 73.8 73.8 73.8
2012 Nov 01
2
Name assignment in for loop
Dear helpeRs-
I'm using a for loop to create a series of models.
I'm trying to assign a name to each model created,
using the loop index. The loop gets stuck at the name
of the model, giving the error "target of assignment
expands to non-language object". The linear model runs
without error; only the name is problematic.
Here is the current loop syntax. The use of dat
2013 Aug 30
3
Memory usage bar plot
Hi,
I haven't tried the code yet. Is there a way to parse this data
using R and create bar plots so that each program's 'RAM used' figures are
grouped together.
So 'uuidd' bars will be together. The data will have about 50 sets. So if
there are 100 processes each will have about 50 bars.
What is the recommended way to graph these big barplots ? I am looking
2011 May 19
3
A better way to do this
Hello gurus,
I have a dataframe containing two groups viz., 'control' and 'case', each of
these groups contains longitudinal data for 100 subjects. I have to plot all
these subjects on a single chart and then put a regression line for each of
the group for all the subjects. I have written a function to do the chart
grpcharts<-function (dat, group,group2,molecule,cutoff){