Displaying 20 results from an estimated 10000 matches similar to: "reading in a subset of a large data set"
2008 Sep 17
2
modifying patterns in a matrix
Dear R-users,
I have some very simple data where 1's represent events and zeroes non-events, e.g.
temp <- rbind(c(0,1,0,0,1,1,1,0), c(0,0,0,1,0,0,0,0))
For each row in the matrix, I would like to replace a singelton event by a 0. That is, any 1 surrounded by zeroes (010) should be replaced by a zero (000). Sequences of 1's should be left unchanged.
So the modified matrix shoud look
2009 Apr 02
1
Sweave, using xtable in a loop doesnt work?
I have a data.frame, data, with 30 factor variables. I would like to tabulate the frequencies of each variable and output to a tex file using Sweave. Here is my code chunk:
<<label=tab, echo=FALSE, results=tex>>=
library(xtable)
for(j in 1:30){
cap <- paste("Frequency counts for Q",j,".", sep="")
xtable(t(table(data[,j])),caption=cap)
}
@
2008 Sep 15
1
How to plot a matrix of intervals
Dear R-users,
I have some nonstandard data set which I would like to plot but don't know how to do it in R. The data is in a matrix where the rows represent samples and the columns represent locations. The entries of the matrix are 0's and 1's, where 1 represents an event and 0 represents a non-event. e.g.
aberrations <- matrix(rbinom(1000, 1, 0.8), nrow=20, ncol=50,
2008 May 22
1
Extracting slots from ROCR prediction objects
Hi,
I have an object from the prediction function from the ROCR package and I would like to extract one of the slots from the object, for example the cutoffs slot. However the usual techniques ($, [["name"]]) of subsetting don't work. How can I assess the lists in the slots?
Here is an example of what I am working with:
library(ROCR)
data(ROCR.simple)
pred <-
2009 Nov 20
1
how to specify the order of panels with xyplot
> chromosomes
id refseq name length
1 0 NC_000001.9 Homo sapiens chromosome 1 247249719
2 1 NC_000002.10 Homo sapiens chromosome 2 242951149
3 2 NC_000003.10 Homo sapiens chromosome 3 199501827
4 3 NC_000004.10 Homo sapiens chromosome 4 191273063
5 4 NC_000005.8 Homo sapiens chromosome 5 180857866
6 5 NC_000006.10 Homo sapiens chromosome 6
2004 Aug 06
1
questions related to ploting in R
Dear all.
I need to draw a scatter plot of 23 chromosome copy numbers (y axes) against
chromosome and physical location within each chromosome in one plot. The
data matrix looks as below:
chr location copy_num
1 118345 1.320118
1 3776202 1.133879
1 4798845 0.989997
1 5350951 1.100967
. more data here
.
.
2 118345 2.459119
2 157739 1.915919
2 1530065 1.924372
2
2007 Nov 14
3
How to get row numbers of a subset of rows
Hello list,
I read in a txt file using
<B<-read.table(file="data.snp",header=TRUE,row.names=NULL)
by specifying the row.names=NULL so that the rows are numbered.
Below is an example after how the table looks like using
<B[1:10,1:3]
SNP Chromosome PhysicalPosition
1 SNP_A-1909444 1 7924293
2 SNP_A-2237149 1 8173763
2009 Dec 04
1
Lattice : Help with changing the labels of x-axis in respective panels
Dear R-Helpers,
I am not very experienced in using lattice and I am still in the learning
stage
I have a data set which looks like this: (I have deleted a few lines in
order to save space)
Chromosome marker Marker.Name Distance
1 1 1 PeMm261 0.0000
2 1 2 Xtxp8 10.1013
..
20 1 20 EbMi148 210.3099
21 1 21 Xtxp25
2008 Jul 09
2
replacing value in column of data frame
Dear all,
Probably a very basic question but I need some help.
I have a data frame (made by read.table from a text file) of microarray data, of which the first column is a factor and the rest of the columns are numeric.
The factor column contains chromosome names, so values 1 through 22 plus X, Y and XY. The numeric columns contain positions or intensity measurements.
What I need to do is
2007 Mar 08
2
Removing duplicated rows within a matrix, with missing data as wildcards
I'd like to remove duplicated rows within a matrix, with missing data
being treated as wildcards.
For example
> x <- matrix((1:3), 5, 3)
> x[4,2] = NA
> x[3,3] = NA
> x
[,1] [,2] [,3]
[1,] 1 3 2
[2,] 2 1 3
[3,] 3 2 NA
[4,] 1 NA 2
[5,] 2 1 3
I would like to obtain
[,1] [,2] [,3]
[1,] 1 3 2
[2,] 2 1 3
2007 Apr 02
3
Random number from density()
Hello,
I'm writing some genetic simulations in R where I would like to place
genes along a chromosome proportional to the density of markers in a
given region. For example, a chromosome can be presented as a list of
marker locations:
Chr1<-c(0, 6.5, 17.5, 26.2, 30.5, 36.4, 44.8, 45.7, 47.8, 48.7, 49.2,
50.9, 52.9, 54.5, 56.5, 58.9, 61.2, 64.1)
Where the numbers refer to the locations of
2010 Jun 01
5
Help barplots
Dear All,
I am newbie to R, and I wanted to plot a barplots with R and in such a way
that It will also show me position which I can plot on the bar line.
Here is my code that I am using to plot,
> chromosome <- c(40.2, 35.6, 36.1, 29.6, 31, 29.6, 31, 29.4, 28.2, 23, 23,
28.2)
>barplot (chromosome, col="purple", xlab="Oryza sativa Chromosomes", border
= NA, space =
2012 Sep 10
3
plot: x and y chromosomes are missing
Hello,
I have a list with gene names, fold changes (=expression level) and
chromosomes.
Names fold change chromosome
hz 1.5 2
If I plot fold change versus chromosome (or vice versa):
plot (ch, fc)
I see only the chromosomes with numbers but not those with letter (x and
y). What can I do?
A second question:
How can I add a single line in that plot at a certain
2011 Apr 20
2
'Record' row values every time the binary value in a collumn changes
My question is twofold.
Part 1:
My data looks like this:
(example set, real data has 2*10^6 rows)
binary<-c(1,1,1,0,0,0,1,1,1,0,0)
Chromosome<-c(1,1,1,1,1,1,2,2,2,2,2)
start<-c(12,17,18,20,25,36,12,15,16,17,19)
Table<-cbind(Chromosome,start,binary)
Chromosome start binary
[1,] 1 12 1
[2,] 1 17 1
[3,] 1 18 1
[4,] 1
2011 Dec 09
1
minor allele frequency comparison
Hi all,
We are using two methods to identify SNPs. One is based on resequencing
the genome and aligning the reads to the sequenced genome to identify SNPs
(data available for 44 individuals). Another is based on SNP array with
selected loci (30000 loci, 870 individuals). I want to compare the results
from the resequencing based minor allele frequency and Array based minor
allele frequency.
2003 Jan 16
1
graphics
Dear R community,
I need to plot the results of some simulations I did using QTL
Cartographer. I am plotting LOD scores over three chromosomes. The three
plot have to be one next to the other.
The procedure I am using is:
par(mfrow=c(1,3))
plot(x$x, x$y, ylim=c(0,35), type="l", col="blue", las=1, xaxs="i",
yaxs="i", xlab="X Chromosome",
2017 Sep 04
1
Merge by Range in R
Hi,?
I have two big data set.?
data _1 :?
> dim(data_1)
[1] 15820 5
> head(data_1)
? ?Chromosome ?????Start????????End????????Feature GroupA_3
1: ? ? ? ????????chr1 521369 ?750000 ????chr1-0001 ? ?????0.170
2: ? ? ? ????????chr1 750001 ?800000 ????chr1-0002 ? ????-0.086
3: ? ? ? ????????chr1 800001 ?850000 ????chr1-0003 ? ?????0.006
4: ? ? ? ????????chr1 850001 ?900000 ????chr1-0004 ?
2012 Jul 13
2
alternate tick labels and tick marks with lattice xyplot
Hi,
I would like to use xyplot to create a figure. Unfortunately, I cannot find
documentation in xyplot to specify alternating the x-axis tick labels with
the x-axis tick marks. I can do this with the regular R plot function as
follows.
#A small version of my data looks like this
data<-data.frame(matrix(ncol=3,nrow=12))
data[,1]<-rep(c(1,2,3),c(4,4,4))
data[,2]<-rep(c(1,2,3,4),3)
2010 Nov 07
1
How do I order xyplot line points?
I have the following xyplot figure:
http://img577.imageshack.us/img577/686/filesizeresults12000000.png
The data are organized in a matrix file as follows:
Type Elements Chromosome Time
bedGz 12000000 chr1 14.240
bedGz 12000000 chr2 7.949
bedGz 12000000 chr3 5.103
bedGz 12000000 chr4 5.290
bedGz 12000000 chr5 5.161
...
The x-axis labels in the Chromosome column are ordered
2009 Mar 23
1
changing order of lattice plots
Hi,
This is another question relating to my 2 factor figure.
densityplot(~End-Begin | Type * Chromosome, data=Mon, layout=c(5,12),
xlab="Element Length",type="percent", col="grey60",
strip=strip.custom(style=3, bg="grey90", par.strip.text=list(cex=0.5)))
I would like to flip the plot so those at the bottom are at the top and
so on. I have tried using a