similar to: calculations with vectors of unequal length

Displaying 20 results from an estimated 80000 matches similar to: "calculations with vectors of unequal length"

2002 Apr 23
3
stacking vectors of unequal length
R-users -- I would like to make a single vector out of something like the following: y0 <- rep(0,100) y1 <- rep(1,20) and stack them one on top of the other to a vector y with length 120. Thanks, Dan =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Dan Powers Associate Professor, Sociology University of Texas at Austin
2009 Jul 20
2
data frame from list of lists with unequal lengths
Hello, I have a dataset with multiple entries in one field separated by "/" characters. (The true dataset has long names, 20-odd variables, and hundreds of observations.) v1 v2 1 A L 2 A/B M 3 C N 4 D/E/F O 5 A P 6 C L What I would like is to have a dataset that looks like this instead: > my.df v1 v2 1 A L 2 A M 3 B M 4 C N 5 D O 6 E O
2007 Oct 04
5
combining vectors on unequal length
If I have two vectors X<-1:10 Y<-1:5 When I combine them using cbind, the shorter one is repeated and both are made of the same length. Is there a methods that does this without duplicating the shorter one. I want to use this to store the data back to a file. Thanks ../Murli [[alternative HTML version deleted]]
2017 Dec 13
0
Add vectors of unequal length without recycling?
Without recycling you would get: u <- c(10, 20, 30) u + 1 #[1] 11 20 30 which would be pretty inconvenient. (Note that the recycling rule has to make a special case for when one argument has length zero - the output then has length zero as well.) Bill Dunlap TIBCO Software wdunlap tibco.com On Tue, Dec 12, 2017 at 9:41 PM, Maingo via R-help <r-help at r-project.org> wrote:
2005 May 20
1
bootstrapping vectors of unequal length
Dear R Help List, I have a vector of n and a vector of n-1 and I want to use boot() to bootstrap the ratio of their respective medians. I want to eventually use boot.ci() to generate confidence intervals. Because the vectors are not equal in length, I tried a few things, but have yet to be successful. Try 1: > x <- runif(20) > > y <- c(runif(19), NA) > > median(x) [1]
2005 Jul 18
1
dataframes of unequal size
I have two dataframes C and C1. Each has three columns viz. state, psu and weight. The dataframes are of unequal size i.e. C1 could be 2/25/50 rows and C has 42000 rows. C1 is the master table i.e. C1$state, C1$psu and C1$weight are never the same. ThisA. P., Urban, 0 is not so for C. For example C state, psu,weight A. P., Urban, 0 Mah., Rural, 0 W.B., Rural,0 Ass., Rural,0 M. P., Urban,0 A. P.,
2008 Jul 02
2
Reading CSV file with unequal record length
Hello , I am having some difficulty reading a CSV file of unequal record length in R . The data has 26 columns and do not have header and is generated from a R syntax - write.table(schat,"schat.csv", sep=",", col.names=FALSE, append = TRUE) 1.0,1.0,0.0,0.1,0.1,0.1,0.2,0.2,0.3,0.3,0.4,0.4,0.5,0.6,0.7,0.8,0.9,1.0,1.2,1.5,1.9,2.7,,,,
2017 Dec 13
4
Add vectors of unequal length without recycling?
I'm a newbie for R lang. And I recently came across the "Recycling Rule" when adding two vectors of unequal length. I learned from this tutor [ http://www.r-tutor.com/r-introduction/vector/vector-arithmetics ] that: """""" If two vectors are of unequal length, the shorter one will be recycled in order to match the longer vector. For example, the
2011 May 04
1
adding columns to dataframes contained in a list
hi there, I have a list of 5 identical dataframes: mydf <- data.frame(x=c(1:5), y=c(21:25)) mylist <- rep(list(mydf),5) and a factor variable with 5 levels: foo <- c(letters[1:5]) foo <- as.factor(foo) Question: I'd like to add a new variable to each dataframe in the list, each containing only one level of the factor variable. So mylist[[1]] should have a new variable z
2009 Oct 07
1
merging dataframes with an unequal number of variables
Hallo Everyone I have the kind of problem that one should never have because one must always plan well and communicate with your team. But now I haven't so here is my problem. I have data coming in on a daily basis from surveys in 10 towns. The questionnaire has 62 variables but some of the regions have used older versions of the questionnaire that have a few variables less. I want to combine
2016 Apr 14
3
Unequal column lengths
Hello, I?ve tried several times to learn R, but have never gotten past a particular gate. My data are organized by column in Excel, with column headers in the first row. The columns are of unequal lengths. I export them as CSV, then import the CSV file into R. I wish to summarize the data by column. R inserts NA for missing values, then refuses to operate on columns with NA. R is importing
2011 Nov 16
3
create list of names where two df contain == values
Hello again... sorry to be posting yet again, but I hadn't anticipated this problem. I am trying to now put the names found in one column in data frame 1 (lets call it df.1[,1]) in to a list from the rows where the values in df.1[,2] match values in a column of another dataframe (df.2[3]) I tried to write this function so that it put the list of names (called Iffy) where the 2 criteria
2004 Sep 13
2
(PR#7225) propogation of rounding error for t.tests with unequal sample sizes (PR#7225)
My apologies for not including the transcript in the original message: > xx <- rep(2.10,80) > groups.balanced <- as.factor(c(rep("one",40),rep("two",40))) > groups.unbalanced <- as.factor(c(rep("one",44),rep("two",36))) > t.test(xx ~ groups.balanced) Welch Two Sample t-test data: xx by groups.balanced t = 0, df = 78, p-value = 1
2010 May 28
1
Match 2 vectors
Hi, I have 2 dataframes of unequal length, and I would like to match a factor to them so that both dataframes will have the same number of rows. example: # create the 2 dataframes with unequal length data1 <- data.frame(letters, 1:26)[-c(5,10,19:21),] data2 <- data.frame(letters, 1:26)[-c(6,9,15:18),] data2a <- match(data1[,1], data2[,1]) data2b <- data2[data2a,] When I match
2001 Oct 16
4
two way ANOVA with unequal sample sizes
Hi, I am trying a two way anova with unequal sample sizes but results are not as expected: I take the example from Applied Linear Statistical Models (Neter et al. pp889-897, 1996) growth rate gender bone development 1.4 1 1 2.4 1 1 2.2 1 1 2.4 1 2 2.1 2 1 1.7 2 1 2.5 2 2 1.8 2 2 2 2 2 0.7 3 1 1.1 3 1 0.5 3 2 0.9 3 2 1.3 3 2 expected results are
2008 May 05
3
merge numerous columns of unequal length
I have numerous objects, each containing continuous data representing the same variable, movement rate, yet each having a different number of rows. e.g. d1<-as.matrix(rnorm(5)) d2<-as.matrix(rnorm(3)) d3<-as.matrix(rnorm(6)) How can I merge these three columns side-by-side in order to create a table regardless of the difference in length? I wish to analyze the output in a spreadsheet
2010 Nov 08
7
How to rbind list of vectors with unequal vector lengths?
Hi, How to rbind these vectors from a list?: > l <- list(a = c(1, 2), b = c(1, 2, 3)) > l $a [1] 1 2 $b [1] 1 2 3 > do.call(rbind, l) [,1] [,2] [,3] a 1 2 1 b 1 2 3 Warning message: In function (..., deparse.level = 1) : number of columns of result is not a multiple of vector length (arg 1) > -J
2011 Jan 20
2
adding text to y-axis per row of panels (lattice)
Dear all, Being a newbie to R, I've trawled through many old posts on this list looking for a solution to my problem, but unfortunately couldn't quite figure it out myself. I'd be very grateful if someone here on this list could perhaps help me out. I have a lattice plot with several panels and would like to add some text next to the y-axis on the right hand side of each row of
2011 May 07
1
Exporting list with unequal length of rows
Dear users I have received an output from one of the functions of igraph. The output is in the following form [[1]] [1] 1 196 94 89 92 197 0 [[2]] [1] 1 [[3]] [1] 1 196 97 193 4 [[4]] [1] 1 194 97 193 4 [[5]] [1] 1 194 97 193 4 6 [[6]] [1] 1 196 97 193 4 6 [[7]] [1] 1 196 97 193 4 185 7 [[8]] [1] 1 194 97 193 4 185 7 [[9]] [1] 1 196 97 193
2006 Mar 12
2
tapply with unequal length of arguments
Hi everyone, Is it possible to use tapply(x,y,mean) if not all groups of x by y are of the same length (for example if you have one missing observation)? I tried tapply(x,y,mean,na.omit=T) but it doesn't work! Steffi -- --------------------------------- Stefanie von Felten Doktorandin ETH Z?rich Institut f?r Pflanzenwissenschaften ETH Zentrum, LFW A 2 Telefon: 044 632 85 97 Telefax: 044