similar to: adding a factor column based on levels of another factor

Displaying 20 results from an estimated 1000 matches similar to: "adding a factor column based on levels of another factor"

2010 Aug 17
4
replacing values in a vector
Dear helpRs Does anyone have an elegant way of doing the following: For a given numeric vector, e.g. vec <- c(3,2,6,4,7) Create a series of vectors where all but 1 of the values are replaced by 0's, e.g. vec.a <- c(3,0,0,0,0) vec.b <- c(0,2,0,0,0) vec.c <- c(0,0,6,0,0) vec.d <- c(0,0,0,4,0) vec.e <- c(0,0,0,0,7) I have looked at `replace', but can't think of a
2005 Jun 28
2
enhanced MDS
Hi again Sorry, in looking again at sammon and isoMDS I see that they seem to do exactly what I want, except that they are non-metric, which means, as I understand it, that they relate the rank orders of the variables rather than the actual distances. Could I use these non-metric MDS packages even if my distances are metric? Thanks Karen -- Karen Kotschy Centre for Water in the Environment
2008 Jan 25
4
Function for translation of a list into a matrix as used by ordination?
Hello. Does anyone know of an existing function that takes a list in the form of: Plot1 Species1 Abundance1 Plot1 Species2 Abundance2 Plot2 Species1 Abundance1 Plot2 Species3 Abundance3 . . . PlotN SpeciesN AbundanceN and translates into a matrix in the form of Species1 Species2.... SpeciesN Plot1 Abundance1 Abundance2... AbundanceN Plot2 Abundance1
2008 Jan 30
2
data.frame transformation
Dear all, maybe somebody can provide some help for this problem: Example: I've got the following dataframe "data": grid.id<-c(1:4) lat<-c(10,12,13,15) species1<-c(0,0,0,1) species2<-c(1,1,0,0) species3<-c(1,1,1,1) data<-data.frame(cbind(grid.id,lat,species1,species2,species3)) How can I, out of "data" make a new dataframe, where the cells of value
1999 Aug 26
1
error bars on barplots
Hello again I'm trying to put error bars onto a barplot. I've tried something that Bill Simpson suggested a while ago, ie: x<-c(1,2,3,4,5) y<-c(1.1, 2.3, 3.0, 3.9, 5.1) ucl<-c(1.3, 2.4, 3.5, 4.1, 5.3) lcl<-c(.9, 1.8, 2.7, 3.8, 5.0) plot(x,y, ylim=range(c(lcl,ucl))) arrows(x,ucl,x,lcl,length=.05,angle=90,code=3) #or segments(x,ucl,x,lcl) but I can't get it to work on a
1999 Dec 21
2
generating a sequence
Hi everyone I'm trying to generate a vector of the form a <- c(1,2,3,4,1,2,3,1,2,1) where n = 5 in a general way, where n can be any positive integer. I've run out of ideas. Does anyone have any suggestions? Thanks Karen Karen Kotschy Centre for Water in the Environment University of the Witwatersrand Johannesburg Tel: 011 716-2218
1999 Dec 21
2
generating a sequence
Hi everyone I'm trying to generate a vector of the form a <- c(1,2,3,4,1,2,3,1,2,1) where n = 5 in a general way, where n can be any positive integer. I've run out of ideas. Does anyone have any suggestions? Thanks Karen Karen Kotschy Centre for Water in the Environment University of the Witwatersrand Johannesburg Tel: 011 716-2218
2005 Dec 22
3
reading long matrix
Hi, I'm needing some help finding a function to read a large text file into an array in R. The data are essentially presence / absence / na data for many species and come as a grid with each species name (after two spaces) at the beginning of the matrix defining the map for that species. An excerpt could therefore be: SPECIES1 999001099 900110109 011101000 901100101 110100019 901110019
2005 Jun 28
1
enhanced multidimensional scaling?
Dear R list Would anyone be able to tell me whether it is possible to do "enhanced multidimensional scaling" (enhanced MDS) in R? In other words, something that goes beyond "cmdscale" by iteratively improving the fit between observed dissimilarities and inter-object distances, using the KYST algorithm (Kruskal, 1964). I have found several implementations of non-metric MDS
2005 Oct 04
2
Joining Dataframes
I am attempting to join several dataframes that summarize sampling effort for different samples into one large data.frame/table. I have looked at the merge command, but have not been clever enough to figure out how to get it to do what I want. A simplified example of what I am trying to do: The dataframes I have look like this (they were generated using the table command) species1.effort
2012 Sep 03
1
Scatter plot from tapply output, labels of data
Hei, i am trying to plot the means of two variables (d13C and d15N), by 2 grouping factors (Species and Year) that i obtained by the function tapply. I would like to plot with different colours according to the Year and show the "Species" as data labels. My data looks like this: Species d13C d13N Year "Species1" 14,4 11.5 2009 "Species2"
2010 Nov 05
3
table with values as dots in increasing sizes
I was just thinking of a way to present data and if it is possible in R. I have a data frame that looks as follows (this is just mockup data). df location,"species1","species2","species3","species4","species5" "loc1",0.44,0.28,0.37,-0.24,0.41 "loc2",0.54,0.62,0.34,0.52,0.71 "loc3",-0.33,0.75,-0.34,0.48,0.61 location
2012 Nov 08
2
Controlling R fonts through LaTeX
Dear help list Does anybody know if it is possible to somehow tell R to let LaTeX handle the fonts for postscript plots produced by R? It is for a thesis and I have MANY figures. These are created by R scripts dynamically as the document is compiled, using the Make system. I see that I can `manually' specify the font family each time I call the postscript device, but I am looking for a
1999 Aug 26
1
moving R objects
Another question: Is it possible to move R objects from one directory to another without copying the whole .RData and .Rhistory files? (I'm running under Linux) Thanks Karen Kotschy Centre for Water in the Environment University of the Witwatersrand Johannesburg Tel: 011 716-2218 -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read
2007 Aug 13
3
Very new - beginners questions
Dear all, I have 4 sites and want to determine how different they are from each other. For this I have decided to use R though it seems a bit daunting to learn. I have read data in from a CSV the structure is : Species1 Species2 Species3 Site1 4 4 7 Site2 3 1 0 Site3 0 99 6 Site4 75 3 33 There are many more species than shown above this is just an example. Here are the
1999 Jul 15
1
matrix indices
Hi Could somebody please explain the following to me: If x is a 10x10 matrix, typing x[3] prints all 10 values of column 3, although the length of the vector =1. Why? x[,3] and x[[3]] both give all 10 values of column 3, length=10. What is the difference between these two, actually? Thanks Karen Kotschy Centre for Water in the Environment Department of Botany University of the Witwatersrand
2005 Jun 24
1
Mahalanobis distances
Dear R community Have just recently got back into R after a long break and have been amazed at how much it has grown, and how active the list is! Thank you so much to all those who contribute to this amazing project. My question: I am trying to calculate Mahalanobis distances for a matrix called "fgmatrix" >dim(fgmatrix) [1] 76 15 >fg.cov <- cov.wt(fgmatrix)
2005 Jul 13
1
Name for factor's levels with contr.sum
Good morning, I used in R contr.sum for the contrast in a lme model: > options(contrasts=c("contr.sum","contr.poly")) > Septo5.lme<-lme(Septo~Variete+DateSemi,Data4.Iso,random=~1|LieuDit) > intervals(Septo5.lme)$fixed lower est. upper (Intercept) 17.0644033 23.106110 29.147816 Variete1 9.5819873 17.335324 25.088661 Variete2 -3.3794907 6.816101 17.011692 Variete3
2011 Nov 24
4
I cannot get species scores to plot with site scores in MDS when I use a distance matrix as input. Problems with NA's?
Hi, First I should note I am relatively new to R so I would appreciate answers that take this into account. I am trying to perform an MDS ordination using the function ?metaMDS? of the ?vegan? package. I want to ordinate species according to a set of functional traits. ?Species? here refers to ?sites? in traditional vegetation analyses while ?traits? here correspond to ?species? in such
2012 Aug 11
1
Ylim problem - plot.correlog, ncf package
Hi, I'm doing cross-correlation correlograms with the ncf package. I have four study sites ; four correlograms. I'd like to get the same y scale for the four of them... only, using "ylim=c(-1,1)" does not change the y scale never and I don't know why. I tried with plot() too. Is there another option to change the ylim in plots ? Example with only one correlog (all work