similar to: help with data layout

Displaying 20 results from an estimated 9000 matches similar to: "help with data layout"

2011 Jun 29
1
median time period
Hello List I'm trying to calculate the median period (in months) of a set of time intervals (between two interventions). I have been playing with the lubridate package to create the intervals but I can't think of the right approach to get the median timeperiod. Toy code: library(lubridate) test <- c('08-04-22', '08-07-28', '09-03-02', '09-03-03',
2009 May 23
2
counting occurrence of text in a dataframe
Hello list. I am hoping for some help with a relatively simple problem. I have a data frame arranged as below. I want to be able to count the occurrence of each gene (eg let-7e) by Experiment. In other words how many times does a given gene crop up in the dataframe. I tried table but couldn't work out how to get the output I want. I have also considered rearranging this data into a list (by
2009 Dec 08
2
Upgrading To 2.10 from 2.6.2
Hello I have a Linux machine (Ubuntu 8.04 hardy, Gcc version 4.2.4 (i486-linux-gnu) currently running R 2.6.2. I'd like to upgrade to 2.10. First Question): What is the appropriate way to remove the old version of R? Part 2. After downloading r-base_2.10.0.orig.tar.gz and opening the archive. I ran the ./configure routine. It failed claiming that it could not find the F77 compiler. My
2005 Sep 27
2
multiple plots on same x axis
Hi. I have two vectors of gene expression for each of several days. I want to plot both vectors on the same plot for a visual representation of up versus down regulation. I've tried using add=T but that doesn't work. eg >plot(Day, gene1) >plot(Day, gene2, add=T) Any help would be appreciated. Iain
2005 Oct 16
3
asking the user for data
Hello everyone. How do I get R to ask users for data to be entered? Specifically I want to ask for a z score to be entered (the user would look this up in a table) and then use the entered data to compute a Dunn's post-hoc test (post kruskal.test). I've tried the "ask" function but it's not recognised - maybe I don't have to appropriate libary installed. A pointer
2012 Nov 28
3
write out list of lists with names
Hello List I have a list question. I'm doing some data wrangling for a colleague and I have nested list in the following format: structure(list(MU10 = structure(c(0.80527905920989, 0.4350488707836, 0.455195366623, 0.565174432205497, 0.208180556861924), .Names = c("MU.16", "MU.19", "MU.21", "mean", "sd")), MU11 =
2009 May 30
1
arithmetic problem
Hello list I have a problem with a dataset (see toy example below) where I am trying to find the difference between two (or more numbers) and discard those observations which fall outside a set interval. An example and further explanation: values ind 1 2655 7A5 2 3028 7A5 3 689 ABBA-1 4 1336 ABBA-1 5 1560 ABBA-1 6 2820 ABLIM1 7 3339 ABLIM1 8
2012 Jul 20
1
conditional subset and reorder dataframe rows
Hi List I have a dataframe (~1,200,000 rows deep) and I'd like to conditionally reorder groups of rows in this dataframe. I would like to reorder any rows where the Chr.Strand column contains a '-' but reorder within subsets delineated by the Probe.Set.Name column. # toy example #### library(plyr) negStrandGene <- data.frame(Probe.Set.Name =
2011 Nov 08
3
ggplot2 reorder factors for faceting
Dear List I am trying to draw a heatmap using ggplot2. In this heatmap I have faceted my data by 'infection' of which I have four. These four infections break down into two types and I would like to reorder the 'infection' column of my data to reflect this. Toy example below: library(ggplot2) # test data for ggplot reordering genes <- (rep (c(rep('a',4),
2009 Jun 20
1
string splitting and testing for enrichment
Hi List I have data in the following form: Gene    TFBS NUDC     PPARA(1) HNF4(20) HNF4(96) AHRARNT(104) CACBINDINGPROTEIN(149) T3R(167) HLF(191) RPA2     STAT4(57) HEB(251) TAF12     PAX3(53) YY1(92) BRCA(99) GLI(101) EIF3I     NERF(10) P300(10) TRAPPC3     HIC1(3) PAX5(17) PAX5(110) NRF1(119) HIC1(122) TRAPPC3     EGR(26) ZNF219(27) SP3(32) EGR(32) NFKAPPAB65(89) NFKAPPAB(89) RFX(121)
2011 Mar 16
3
making dataframes
Dear all, I have a dataframe which looks like this (dummy): date<-c("jan", "feb", "mar", "apr", "may", "june", "july", "aug","sep","oct","nov","dec") col1<-c(8.2,5.4,4.3,4.1,3.1,2.5,1.1,4.5,3.2,1.9,7.8,6.5) col2<-c(3.1,2.3,4.7,6.9,7.5,1.1,3.6,8.5,7.5,2.5,4.1,2.3)
2012 Aug 13
4
if else elseif for data frames
Hi all, It seems like I cannot use normal 'if' for data frames. What would be the best way to do the following. if data$col1='high' data$col2='H' else if data$col1='Neutral' data$col2='N' else if data$col='low' data$col2='L' else #chuch a warning? Note that col2 was not an existing column and was newly assigned for this
2006 Mar 16
3
Did I use "step" function correctly? (Is R's step() function reliable?)
Hi all, I put up an exhaustive model to use R's "step" function: ------------------------ mygam=gam(col1 ~ 1 + col2 + col3 + col4 + col2 ^ 2 + col3 ^ 2 + col4 ^ 2 + col2 ^ 3 + col3 ^ 3 + col4 ^ 3 + s(col2, 1) + s(col3, 1) + s(col4, 1) + s(col2, 2) + s(col3, 2) + s(col4, 2) + s(col2, 3) + s(col3, 3) + s(col4, 3) + s(col2, 4) + s(col3, 4) + s(col4, 4) + s(col2, 5) + s(col3,
2017 Aug 23
2
Comparing 2 dale columns
Dear R fellows, I created a new column Date_flag to compare the dates of COL1 and COL2 using the code below. But it showed that 5/1/15 is greater than 6/1/2014 and 5/1/2015 greater than 7/1/2014 despite the year is greater. How do I fix that? I did try to format as %y/%m/%d but it does not fix that. data$Date_Flag <- ifelse(data$COL2 > data$COL1, 0,1) COL1 COL2 6/1/14
2018 Feb 25
3
include
Thank you Jim, I read the data as you suggested but I could not find K1 in col1. rbind(preval,mydat) Col1 Col2 col3 1 <NA> <NA> <NA> 2 X1 <NA> <NA> 3 Y1 <NA> <NA> 4 K2 <NA> <NA> 5 W1 <NA> <NA> 6 Z1 K1 K2 7 Z2 <NA> <NA> 8 Z3 X1 <NA> 9 Z4 Y1 W1 On Sat, Feb 24, 2018 at 6:18 PM, Jim
2018 Feb 25
0
include
Hi Val, My fault - I assumed that the NA would be first in the result produced by "unique": mydat <- read.table(textConnection("Col1 Col2 col3 Z1 K1 K2 Z2 NA NA Z3 X1 NA Z4 Y1 W1"),header = TRUE,stringsAsFactors=FALSE) val23<-unique(unlist(mydat[,c("Col2","col3")])) napos<-which(is.na(val23)) preval<-data.frame(Col1=val23[-napos],
2010 Dec 18
0
[BioC] problem with function
Hi Christian, Chuck (and lists) It seems that the problem may be the strange behaviour of 'unstack' inside a function. See this thread in the R mailing list: http://tolstoy.newcastle.edu.au/R/help/04/03/1160.html Anyway, I got round the problem by using 'aggregate' instead of converting to a list and then tapply to sum values of metric. Probably more efficient as well. Thanks
2018 Feb 25
2
include
HI Jim and all, I want to put one more condition. Include col2 and col3 if they are not in col1. Here is the data mydat <- read.table(textConnection("Col1 Col2 col3 K2 X1 NA Z1 K1 K2 Z2 NA NA Z3 X1 NA Z4 Y1 W1"),header = TRUE,stringsAsFactors=FALSE) The desired out put would be Col1 Col2 col3 1 X1 0 0 2 K1 0 0 3 Y1 0 0 4 W1 0 0 6 K2 X1
2005 Oct 07
2
finding missing lines...
Take this as an example: > a=data.frame(col1=c(1,2,3,4,5), col2=c ("my","beloved","daughter","son","wife")) > b=data.frame(col1=c(1,2,4), col2=c("my","beloved","son")) > a col1 col2 1 1 my 2 2 beloved 3 3 daughter 4 4 son 5 5 wife > b col1 col2 1 1 my 2
2017 Aug 23
0
Comparing 2 dale columns
Patrick, ## Run the following script an notice the different values of the dataframe "data" in each instance. # I understand you have done something like the following: data <- data.frame(COL1 = c("6/1/14", "7/1/14"), COL2 = c("5/1/15", "5/1/15"), stringsAsFactors = FALSE) data$Date_Flag <- ifelse(data$COL2 >