similar to: column names issue with read.csv

Displaying 20 results from an estimated 4000 matches similar to: "column names issue with read.csv"

2011 Sep 27
2
inset one map on top of another map
I want to overlay a small inset map on top of another map, but I can't figure out how to do it. For example, here are two different maps: # map 1 - Ohio map("state", region= "ohio") # map 2 - US with Ohio darkened map("state") map("state", region="ohio", fill=T, add=T) I would like to add map 2 as a small inset in the corner of map 1. I
2011 Aug 19
1
how to merge distance data based on location
Hi all, I have two data frames, two columns each, 1000s of rows. Each row represents a segment of the genome where a deletion has occurred. First column is start position of the deletion in genomic distance, second is end position. So, e.g., first 3 rows of data frame A is: 1003 1023 5932 6120 12348 12689 first 3 rows of data frame B is: 852 5305 1010 1015 8500 9500 10000 13000 I want to merge
2011 Aug 19
2
display only the top-right half of a correlation matrix?
Dear all Is there an easy way to display only one half (top-right or bottom-left) of a correlation matrix? > require(Hmisc) > rcorr(as.matrix(mtcars[ , 1:4])) mpg cyl disp hp mpg 1.00 -0.85 -0.85 -0.78 cyl -0.85 1.00 0.90 0.83 disp -0.85 0.90 1.00 0.79 hp -0.78 0.83 0.79 1.00 n= 32 P mpg cyl disp hp mpg 0 0 0 cyl 0 0 0 disp 0 0
2011 Aug 05
1
Displaying a summary in graphics
I'm writing a script which puts together a bunch of graphs and outputs them to a graphics device. One of the things I want to add is ANOVA summaries but I'm having trouble with formatting them for graphics. I do this: anova_summary <- summary(aov(concentration~inhibition*genotype, data =drug_data)) print(anova_summary) The printout to the R console is in the format I want but if I
2011 Jun 15
2
Count occurances in integers (or strings)
Hi, I have a dataframe column from which I want to calculate the number of 1's in each entry. Some column values could, for example, be "0001001000" and "11110000111". To get the number of occurrences from a string I use this: sum(unlist(strsplit(mydata[,"my_column"], "")) == "1") However, as my data is not in string form.. How do I convert
2011 Aug 03
2
syntax with do.call and `[`
Dear List, i would like to mimic the behaviour or the following indexing with a do.call construct to be able to supply the arguments to `[` as a list: test = matrix[1:4,2] result = test[2,] My try, however, did not work: result = do.call(`[`,list(test,2,NULL)) result = do.call(`[`,list(test,2,)) result = do.call(`[`,list(test,2,'')) How can I use the do.call in that way with
2011 Aug 10
2
function runif in for loop
Hello, I'd like to perform a regression using MCMCregress (MCMCpack). One variable therefore should be a function rather than a variable: I want to use X as an input and X should be defined as a random number between to values. Therefore I want to use the function runif like: X <-(1, Xa, Xb) but it seems that runif doesn't allow to use vectors. So I think I've to calculate the new
2011 Jul 27
2
plotting the ending point in a for loop
Hello, I would appreciate if someone could help me with this query. I would like to plot a line chart of all of the points in a "for" loop. I would also like to plot the final point with a symbol (to show where the random walk ends). Here is the code I am using: Brownian.fn <- function(mu, sigma, T, N){ dt <- T/N t <- c(rep(NA, N)) B1 <- c(rep(NA, N)) B2 <- c(rep(NA,
2011 Aug 10
2
round() a data frame containing 'character' variables?
Dear all It is difficult to use round(..., digits=2) on a data frame since one has to first take care to remove non-numeric variables such as 'character' or 'factor': > head(round(iris, 2)) Error in Math.data.frame(list(Sepal.Length = c(5.1, 4.9, 4.7, 4.6, 5, : non-numeric variable in data frame: Species > head(round(iris[1:4], 2)) Sepal.Length Sepal.Width Petal.Length
2011 Aug 05
2
R compare cells in one matrix
Good morning! Please, could you help me with the problem? I have a matrix *144x73.* An example of a matrix: [,1] [,2] [,3] [,4] [,5] [1,] 277.4 276.24 275.62 276.55 278.05 [2,] 277.4 276.24 275.55 276.42 277.72 [3,] 277.4 276.24 275.50 276.22 277.39 [4,] 277.4 276.24 275.42 276.02 277.02 [5,] 277.4 276.22 275.37 275.82 276.64 And I want to *compare*its cells
2011 Jul 28
3
Data frame to list
I'm hoping this is an easy problem that I'm missing something obvious. Given: x=c(1,1,1,2,2,3,3,3) y=c(1:length(x)) dataframe=data.frame(x,y) I would like to convert this to a list for use with certain functions, where each entry of the list is a subsetted dataframe based on dataframe$x I can do this "brute force" by a for-next loop: unique_x=unique(dataframe$x)
2011 Aug 01
3
possible reason for merge not working
Hi Guys, working on a "merge" for 2 data frames. Using the command: x <- merge(annotatedData, UCSCgenes, by.x="names", by.y="Ensembl.Gene.ID", all.x=TRUE) names and Ensembl.Gene.ID are columns with similar elements from the x and y data frames. annotatedData has 8909 entries, so has x(as expected). x has columns for UCSCgenes, but there is no data in them, all
2011 Aug 02
2
Data frame to matrix - revisited
Hi, I've tried to look through all the previous related Threads/posts but can't find a solution to what's probably a simple question. ? I have a data frame comprised of three columns e.g.: ? ID1?ID2?Value a?b?1 b?d?1 c?a?2 c?e?1 d?a?1 e?d?2 ? I'd like to convert the data to a matrix i.e.: ? ?a b c d e a n/a 1 2 1 n/a b 1 n/a n/a 1 n/a? c 2 n/a n/a n/a 1 d 1 1 n/a n/a 2 e n/a n/a 1
2011 Aug 04
3
R loop problem
I have run into a speed issue, and given the size of the problem it feels like there should be an easy solution. Here is the problem statement with some arbitrary numbers added. #p,q: vector with length(q)==length(p)==10000 and length(levels(p))==3000 #y,z: vectors with length(levels(y))=length(y)==length(z)==5000 for (i in levels(p)){ q[i==p]<-z[i==y]} At first i used two for loops which
2010 Aug 05
2
colour of label points on a boxplot
Hi all, I have 6 datasets(dataframes Assem_ContigsLen7 through all_ContigsLen12) containing 3 columns (contig_id, contig_length, read_count). Each dataset is composed of 3 types of contigs (assemblies of genomic fragments), 1- all Bacterial fragments, 2 - all Viral fragments, 3 - mixed fragments. I identified the type of contig through a merge with another table with just contig_id and
2011 Aug 01
4
fill Matrix quicker
dear all, i have a quite simple question, i want to fill up a Matrix like done in the following function, but the performance is very bad for large dimensions is there a way to do this like with apply or something similar? makeMatrix <- function(a, b,dim) { X=matrix(0,ncol=dim,nrow=dim) for (i in c(1:dim)){ for (j in c(1:dim)) { if (i==j) {X[i,j]<-a} else { X[i,j]<- exp((
2011 Jul 29
2
change pch in 3dplot, export graph
Hello I was wondering if anyone has been able to change the pch value for points in 3dplot()? I am able to change point colors just not symbol types. I have included a portion of my code below. I realize this won't work outside of my script, but thought, maybe there is something obvious that I am doing wrong. Also is it possible to utilize the interactive feature of 3dplot in a
2011 Aug 10
2
Histograms in R
HI everyone, I'm plotting a histogram in R and within that histogram i need to demonstrate the percentage of another variable (Percentage of MutStatus) within the bins plotted inthe histogram....I don't know how to do that! Data:Validation_Status Mutation_Status TvarRatio Wildtype None 0.08 Wildtype None 0.08 Wildtype None 0.08 Wildtype None 0.08 Wildtype None 0.080139373 Wildtype None
2011 Aug 10
1
Plotting Ellipses and Points of Matching Colors in an Ordination
Hello, R-Help - I am trying to plot the results of an ordination from package vegan. The tricky part for me right now is getting the colors of the ellipses denoting the 95% confidence intervals of the group centroids to match the colors of the points for those same groups. >From and earlier post, I saw the code to make a plot of the ordination using different colors for my different groups.
2011 Aug 05
2
problemsn in using nls
Dear all, I tried to use nls, but I got the following error Error in numericDeriv(form[[3L]], names(ind), env) : Missing value or an infinity produced when evaluating the model Any suggestion? Thanks, Paola. The code I wrote is Data_pp2_mrna <- data.frame( p1 = protein_1, p6 = protein_6, pp2_mrna