similar to: data frame from list of lists with unequal lengths

Displaying 20 results from an estimated 20000 matches similar to: "data frame from list of lists with unequal lengths"

2008 Jun 13
1
help with colsplit (reshape)
Dear list, I'm trying to figure out how to use the reshape package to reshape data from a "wide" format to a "long" format. I have data like this pid <- c(1:10) predA <- c(-1,-2,-1,-2,-1,-2,-1,-2,-1,-2) predB.1 <- c(0,0,0,1,1,0,0,0,1,1) predB.2 <- c(2,2,3,3,3,2,2,3,3,3) predC.1 <- c(10,10,10,10,10,11,11,11,11,11) predC.2 <-
2012 Sep 27
4
Colsplit, removing parts of a string
Hi, I am using colsplit (package = reshape) to split all strings in a column according to the same patterns. Here an example: library(reshape2) df1 <- data.frame(x=c("str1_name2", "str3_name5")) df2 <- data.frame(df1, colsplit(df1$x, pattern = "_", names=c("str","name"))) This is nearly what I want but I want to remove the words
2010 Oct 26
4
divide column in a dataframe based on a character
Hello, If I have a dataframe: example(data.frame) zz<-c("aa_bb","bb_cc","cc_dd","dd_ee","ee_ff","ff_gg","gg_hh","ii_jj","jj_kk","kk_ll") ddd <- cbind(dd, group = zz) and I want to divide the column named group by the "_", how would I do this? so instead of the first row being x
2009 Nov 23
2
how to change the class of a group of objects
Dear R users, I would like to change the class of a group of objects in R memory from "numeric" to "dist". I can manipulate the class using class(foo) <- bar but I cannot get the same command to work on groups of variables. When I use for() loops and lists of names, inevitably I have to specify class(get("foo")) <- bar which causes class() to return an
2012 May 05
2
creating a new column assigning values of other columns
Hello, ? I have to create a new column from the values of other columns of a data frame. The new?column (y$n) is created imposing a condition (using a third variable y$h) that assigns the values of two time variables (y$b and y$timepos). Here's the piece of code to get there (using the attached files): ? xact <- read.table("act.lig", sep = ',',
2009 Aug 17
1
FYI conflict between statnet, igraph
Dear R users: There appears to be a conflict between the statnet package and the igraph package. With igraph loaded into memory, the network() function of statnet failed, returning the error to the effect that the matrix being converted was "not a graph object." Removing igraph from memory restored statnet to proper function. Apologies if this is redundant. I could not find this
2011 Jan 20
4
How to reshape wide format data.frame to long format?
Dear list, I need to convert this data.frame > names(codesM) [1] "key" "AMR.pa1.M" "AMR.pa2.M" "AMR.pa3.M" "AMR.pa4.M" [6] "AMR.pa5.M" "AMR.pa6.M" "AMR.pa7.M" "AMR.pa8.M" "AMR.pa9.M" [11] "AMR.pa10.M" "AMR.ta1.M" "AMR.ta2.M" "AMR.ta3.M"
2012 Apr 30
1
Subtract days to dates in POSIXct format
Hello, I'm having problems working with date values in POSIXct format. Here is what I got (eg.lig attached): x <- read.table("eg.txt", sep = ',', col.names=c("ok","time","secs","lig")) # it gives time as factor z <- cbind(x,colsplit(x$time, split="\\s", names=c("date", "clock")))
2009 Sep 25
7
Spliting columns, strings or reg exp returning substrings
Currently as the first column in a data frame I have string values in the format xx_yy - I want to create a new column with just the substring xx (for each row in turn). Three possible ways to do this might be (1) split the string by '_' using strsplit and paste the first of the resulting variables into a new column, but I have been unable to do this for each row of my data frame in turn
2012 Jul 21
4
rhsape2 bug?
All, I believe I am running the latest version of rshape2 (1.2.1). But this code: library(reshape2) tmp <- melt(smiths, id.vars=1:2, measure.vars=c("age","weight","height"), variable.name="myvars", value.name="myvals" ) names(tmp) Produces this output: > names(tmp) [1] "subject" "time"
2010 Jul 19
3
Reshaping data
Dear All, I have some data in the following shape: ID begin_t1 end_t1 begin_t2 end_t2 Thomas 11/03/04 13/05/06 04/02/07 16/05/08 ... ... ... ... ... Jens 24/01/02 23/05/03 07/06/03 14/11/05 I would like to reshape this data to have the following form: ID Begin_Time End_Time Thomas 11/03/04 13/05/06 Thomas 04/02/07 16/05/08 ... ... ... Jens 24/01/02 23/05/03 Jens
2008 May 19
1
reshape a wide data frame from wide to a long format with metadata columns
Hello R users and developers, I have a general question about reshaping a wide data frame using the "reshape" command. I have a data frame consisting of 108 columns that I would like to convert to a long table and remove the metadata (embedded in the column names of the wide table) to new metadata columns in the long format. #example data frame. NOTE column names contain metadata::
2010 May 11
3
Advice needed on awkward tables
Dear r-help list members, I am quite new to R, and hope to seek advice from you about a problem I have been cracking my head over. Apologies if this seems like a simple problem. I have essentially two tables. The first (Table A) is a standard patient clinicopathological data table, where rows correspond to patient IDs and columns correspond to clinical features. Records in this table are stored
2007 Jan 27
2
unequal number of observations for longitudinal data
i have a large longitudinal data set. The number of observations for each subject is not the same across the sample. The largest number of a subject is 5 and the smallest number is 1. now i want to make each subject to have the same number of observations by filling zero, e.g., my original sample is id x 001 10 001 30 001 20 002 10 002 20 002 40 002 80 002 70 003 20 003 40 004 ...... now i wish
2013 Mar 11
0
splitting column into two
HI, Try this: dat1<- read.table(text=" ?V1,V2,V3,V4,V5,V6,V7 ?chr1,564563,564598,564588 564589,1336,+,134 ?chr1,564620,564649,564644 564645,94,+,10 ?chr1,565369,565404,565371 565372,217,+,8 ?chr1,565463,565541,565480 565481,1214,+,15 ?chr1,565653,565697,565662 565663,1031,+,28 ?chr1,565861,565922,565883 565884,316,+,12 ",sep=",",header=TRUE,stringsAsFactors=FALSE)
2011 Aug 27
1
Overdispersed GLM
Hi all, I have the following data: rep1_treat rep2_treat rep1_control rep2_control 2 3 4 5 100 20 98 54 0 1 2 3 23 32 27
2009 May 18
8
Simple plotting errors
Dear R Users, I have 12 data frames, each of 12 rows and 2 columns. e.g. FeketeJAN MEAN SUM_ AMAZON 144.4997874 68348.4 NILE 5.4701955 1394.9 CONGO 71.3670036 21196.0 MISSISSIPPI 18.9273250 6511.0 AMUR 1.8426874 466.2 PARANA 58.3835497 13486.6 YENISEI 1.4668313 592.6 OB 1.4239179 559.6 LENA 0.9342164
2012 Jun 28
6
Help
Dear all, I need some help on plotting multiple boxplots on one figure. I have three matrix A, B and C. Each of them is a 1000 by 10 matrix. The 10 columns of all three matrix correspond to the 10 values of the same parameter, say k=1, ..., 10. I want to make a plot where x axis represents different values of k. For each k value, I want to plot three boxplots, one on top of another. For
2010 Oct 04
3
vectorizing problem
Hello, I have a two column dataframe that has entries that look like this: 2315100 NR_024005,NR_024004,AK093685 2315106 DQ786314 and I want to change this to look like this: 2315100 NR_024005 2315100 NR_024004 2315100 AK093685 2315106 DQ786314 I can do this with the following "for" loop but the dataframe (GPL) has ~140,000 rows and this takes
2011 May 17
2
reshaping issue
Dear R users, I have a problem with reshaping data. I know such questions have been asked before, but I can't get it right, neither with the reshape function nor with the melt function. My dataset has about 407 variables and about 48000 cases. Each case looks as follows: V1 v2 v3 v4 v5 v6 v7 x1 y1 x2 y2 .... x200 y200 V1 is unique, v2-v7 are