similar to: How to get the value of last element in a vector/array ?

Displaying 20 results from an estimated 20000 matches similar to: "How to get the value of last element in a vector/array ?"

2007 Jan 27
3
how to handle a longitudinal data
i have a data set with repeated measures on same people, structure like below: id x1 x2 ... 001 10 20 ... 001 8 45 ... 001 4 2 ... 002 .... 002 ... 002 .... 002 .... 003 .... ....... what is the easist way to show how many observations for each subject id? [[alternative HTML version deleted]]
2010 May 13
3
How ls() only functions or anything else but functions?
Hello, How ls() only functions or only data objects (basically anything other than functions) such as data.frame, numeric ...? John [[alternative HTML version deleted]]
2008 Apr 14
3
Power curves
Hi, I am trying to create a power curve to show how the power of a t-test varies depending on the mean. Any ideas how I should go about this? Louisa _________________________________________________________________ [[alternative HTML version deleted]]
2010 Apr 25
3
Determining Index of Last Element in Vector
Hi, Is there a way to specify the last element of a vector, similar to "end" in MATLAB? v[end] would be MATLAB for v(length(v)) in R. While `v(length(v))' does yield the last element, that approach fails in the following, rep(v, each=2)[-c(1,length(v))] which is meant to duplicate all elements of `v' except for the first and last. (I.e., if `v <- 1:4', then
2007 Dec 19
3
median of binned values
Dear list, I have a vector (array, table row, whatever is best) of frequency values for categories (or bins), and I need to find the median category. Trivial to do by hand, but I was wondering if there is a means to do it in R in an elegant way. The obvious medioan(vector) returns the median frequency for the binns, and that is not what I want. i.e,: freq cat1 1 cat2 10
2007 Sep 19
2
By() with method = spearman
I have a data set where I want the correlations between 2 variables conditional on a students grade level. This code works just fine. by(tmp[,c('mtsc07', 'DCBASmathscoreSPRING')], tmp$Grade, cor, use='complete', method='pearson') However, this generates an error by(tmp[,c('mtsc07', 'DCBASmathscoreSPRING')], tmp$Grade, cor, use='complete',
2007 Jan 23
4
Vector to Matrix transformation
Hi R, I have a vector V1 of unknown length, say n. I need to convert this into a matrix C of row size=5, and accordingly the column should be updated. I tried with: C=as.matrix(V1,5,n/5) But it is not working...Could somebody help me on this? Thanks in advance... [[alternative HTML version deleted]]
2008 Feb 24
3
Newbie: Where is lmFit function?
Hi Everyone, I am trying to use lmFit function; however, i cannot find it function anywhere. I have been trying to find the function in Bioconductor and elsewhere. I re-install bioconductor source, update package and update R as well. no luck Is there a command in R where i can just type, and it will download it for me? -- View this message in context:
2009 Jun 12
3
Replacing 0s with NA
Hello I have a dataset in which I would like to replace 0s with NAs. There is a lot of information on how to replace NAs with 0, but I have struggled to find anything with regards to doing the reverse. Any recommendations would be great. Cheers Christine
2006 Aug 24
5
xyplot tick marks and line thickness
Hello, A made a xyplot using the lattice library in R (latest version). The publisher of our paper has requested: 1. all tick marks should point inwards instead of outwards. 2. All lines should be thicker (lines, axes, boxes, etc. Everything). Lines is easy...I used: lwd=1.5 but what about the lines of the axes, and the lines that build up the plot itself?....? Any
2006 Aug 31
2
need help with an interaction term
Hello! I?m fitting a model with glm(family binomial). The best model counts 9 Variables and includes an interaction term that was generated by the product of to continuous variables (a*b). All variables are correlated under a value of 0.7 (Spearman rank order) While the estimates of both main effects are negativ, the resulting interaction term is positiv. This change of sign makes it difficult to
2006 Dec 21
4
where is the source code of bca.ci?
i was searching for the source of bca.ci, a function of the package boot. I tried require(boot, keep.source=TRUE) but again the source was not viewable. How should i do? Best regards Meinhard Ploner ---------------- PS > version _ platform i386-apple-darwin8.8.1 arch i386 os darwin8.8.1 system i386, darwin8.8.1 status major 2
2010 Mar 01
3
setting the steps for x axis labels on plot
Hello, I'm new to R, I've been working with it for the last 2 weeks. I am plotting some data and not getting the labels on the x axis I am expecting on my plot. my code reads #hours in the day h <- c(0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23) #hp is a data frame with a pivot table of 25 columns (label and data for 24 hours) plot(h, as.matrix(hp[1,2:25]),
2007 Jun 24
2
adding lines to stripchart
I have two points of collection across 20 subjects (pre and post for each), so 20 pairs of data points. I would like to plot the actual raw data points for each subject for both pre and post and connect lines between these two points (20 in all) to depict real change between the two timepoints. I have tried using stripchart which adequately plots the two lines of subject data points. Attempting
2004 Jun 09
3
Dot chart question
Running R 1.8.1 on a Windows machine In dotchart, I would like to shrink the labels on the tick marks (that is, the numbers) without shrinking anything else. I could not find this in either the Rhelp archives or in ?dotchart, which recmmends cex to avoid 'label overlap', but cex shrinks all the characters in the plot. Is there a way to do this? Thanks Peter Peter L. Flom, PhD
2008 Jun 06
5
request: a class having max frequency
Dear R users I have a very basic question. I tried but could not find the required result. using dat <- pima f <- table(dat[,9]) > f 0 1 500 268 i want to find that class say "0" having maximum frequency i.e 500. I used >which.max(f) which provide 0 1 How can i get only the "0". Thanks and best regards Muhammad Azam Ph.D. Student Department of
2008 Aug 07
6
multiple tapply
Hi folk, I tried this and it works just perfectly tapply(iris[,1],iris[5],mean) but, how to obtain a single table from multiple variables? In tapply x is an atomic object so this code doesn't work tapply(iris[,1:4],iris[5],mean) Thanx and great summer holidays Gianandrea -- View this message in context: http://www.nabble.com/multiple-tapply-tp18868063p18868063.html Sent from the R help
2008 Nov 17
1
An array of an array of boxplots in lattice
Using the data set fgl in MASS the following code layout(matrix(1:9,3,3)) for(i in 1:9){ boxplot(fgl[,i] ~ type, data = fgl,main=dimnames(fgl)[[2]][i])} produces a 3 by 3 array of plots, each one of which consists of six boxplots. Is it possible to do this in lattice? Steve "R version 2.7.2 (2008-08-25)" on Ubuntu 6.06
2009 Dec 02
4
Finding cases in one subset that are closet to another subset
Good afternoon Running R2.10.0 on Windows I have a data frame that includes (among much else) a factor (In_2006) and a continuous variable (math_3_4). I would like to find the 2 cases for In_2006 = 0 that are closest to each case where In_2006 = 1. My data looks like In_2006 math_3_4 0 55.1 1 51.6 1 18.1 1 26.6 1 14.1
2006 Feb 28
2
vector math: calculating a rolling 12 row product?
I have a dataframe of numeric values with 30 ?rows? and 7 ?columns?. For each column, beginning at ?row? 12 and down to ?row? 30, I wish to calculate the ?rolling 12 row product?. I.e., within each column, I wish to multiply all the values in row 1:12, 2:13, 19:30. I wish to save the results as a new dataframe, which will have 19 rows and 7 columns.