similar to: a question on subset a dataset

Displaying 20 results from an estimated 120 matches similar to: "a question on subset a dataset"

2006 Apr 12
2
subset a matrix
Dear friends, I have a (20*30) matrix,and want to get a subset of it like the following: The original matrix: rows:1,2,3,....20; columns:1,2,3,....30 I want to get my subset of The original matrix and delete others: rows:1,3,5,7,...19; columns:1,3,5.....29 -- Kind Regards,Zhi Jie,Zhang ,PHDDepartment of EpidemiologySchool of Public HealthFudan UniversityTel:86-21-54237149
2006 Mar 22
1
How to join "specific Special Interest Group (=: SIG) mailing lists"
there are several specific Special Interest Group (=: SIG) mailing lists,and i'm interested in the"R-sig-Geo :R Special Interest Group on using Geographical data and Mapping ",but can't find how to join it, could anybody tell me how to do that? thank u very much! -- Kind Regards,Zhi Jie,Zhang ,PHDDepartment of EpidemiologySchool of Public HealthFudan
2006 Mar 24
1
who can tell me the reason why it is different on calculating Moran's I using ARCGIS, Geoda and R?
The attachment is my dataset: 1.ccc.shp (the original data) 2.ccc.gwt, which is computed by Geoda; Introduction to the variables in my data: ID: key variable; N_LATITUDE: latitude measured by GPS; E_LONGITUD: longitude measured by GPS; LIVES: attribute data I get the different result of Moran's between ARCGIS and Geoda, R, why? ARCGIS:spatial statistics tools:spatial
2006 Jun 08
1
how to analyze the following data?--anxious for the result
Dear friends, I have a dataset: response var--y, class var-group, and the third variable-x. I want to test whether there is statistical significance bewteen group for y with the controlled x. First, i want to use analysis of covariance in SAS, but i found that y isn't noramal and can't become normal through transformation. Under that condition, what should i do using R / SAS? Any
2012 Sep 17
6
help with calculation from dataframe with multiple entries per sample
Hi  I have a dataframe similar to: >Sample<-c(1,1,1,2,2,2,3,3,3) >Time<-c(1,2,3,1,2,3,1,2,3) >Mass<-c(3,3.1,3.4,4,4.3,4.4,3,3.2,3.5) >mydata<-as.data.frame(cbind(Sample,Time,Mass))   Sample Time Mass 1      1    1  3.0 2      1    2  3.1 3      1    3  3.4 4      2    1  4.0 5      2    2  4.3 6      2    3  4.4 7      3    1  3.0 8      3    2  3.2 9      3    3
2006 Mar 21
1
Getting polygons from contiguous grid cells having same value in sp
I have been using the sp package to deal with gridded data. I would like to know how to extract the vertices (x,y) of polygons that outline areas of like-valued cells in a grid. Here is a simple 3x3 grid: 2 2 1 1 2 1 1 1 3 x <- c(1,1,1,2,2,2,3,3,3) # define a 3 x 3 array of points y <- c(1,2,3,1,2,3,1,2,3) h <- SpatialPoints(cbind(x,y)) # make these an sp object of the points
2006 Jul 04
2
random sampling problems?
Dear friends, suppose my dataset is the following data: id<-1:9 x<-c(1,2,3,1,2,3,1,2,3) y<-c(1,1,1,2,2,2,3,3,3) data<-data.frame(id,x,y) id x y 1 1 1 1 2 2 2 1 3 3 3 1 4 4 1 2 5 5 2 2 6 6 3 2 7 7 1 3 8 8 2 3 9 9 3 3 i want to do sampling like this:say the sample size is 3. First: random sampling from x; Next ,random sampling from
2006 Aug 03
2
fitting a model with the nlme package
Dear all, I am analyzing some data that requires a mixed model. I have been reading Pinheiro and Bates' book, but cannot find the notation to fit the following model: Suppose I have the dataset below. Here I am fitting variable p as a fixed effect, variable h as a random effect and variable t as nested within h. I would like to include the variable j as well as an independent (non-nested)
2008 Jan 26
2
scatterplot3d with categorical data
Dear users, I'm trying to produce a 3d bar plot but the x and y dimensions have categorical data -- so I only want 3 points on each axis. So I try: require(scatterplot3d) mymat<-data.frame( x=c(1,1,1,2,2,2,3,3,3), y=c(1,2,3,1,2,3,1,2,3), z=c(1,2,3,4,5,6,7,8,9)) scatterplot3d(mymat, type="h", lwd=5, pch=" ", xlab="xlabel",
2010 Aug 03
2
Collinearity in Moderated Multiple Regression
Dear all, I have one dependent variable y and two independent variables x1 and x2 which I would like to use to explain y. x1 and x2 are design factors in an experiment and are not correlated with each other. For example assume that: x1 <- rbind(1,1,1,2,2,2,3,3,3) x2 <- rbind(1,2,3,1,2,3,1,2,3) cor(x1,x2) The problem is that I do not only want to analyze the effect of x1 and x2 on y but
2010 Apr 05
1
strange behavior of matrix
Dear R list, I have discovered a seemingly peculiar feature when using a matrix to index itself (yes, this is strange code, which I have now modified to be more reasonable). #this makes sense s <- matrix(1:3,nrow=1) s[s] #all three elements are shown #but when I try s <- matrix(1:2,nrow=1) s[1] #fine, the first element is shown s[2] #fine, the second element is
2005 Jul 19
1
Question about creating unique factor labels with the factor function
Hi guys, I ran into a problem of not being able to create unique labels when creating a factor. Consider an example below: hb <- factor(c(1,1,1,2,2,2,3,3,3), levels=c(1,2,3),labels=c(1,1,2)) > hb [1] 1 1 1 1 1 1 2 2 2 Levels: 1 1 2 > unique(hb) [1] 1 1 2 Levels: 1 1 2 How come there are three unique levels, I thought this would only create one unique level? >
2012 Jul 20
3
Crosstab with Average and Count
I have the following data: x <- as.factor(c(1,1,1,2,2,2,3,3,3)) y <- as.factor(c(10,10,10,20,20,20,30,30,30)) z <- c(100,100,NA,200,200,200,300,300,300) I could create the cross tab of x and y with Sum of z as its elements using the xtabs function as follows: # X Vs. Y with Sum Z xtabs(z ~ x + y) y x 10 20 30 1 200 0 0 2 0 600 0 3 0 0 900 How do I replace
2004 Jul 28
6
elegant matrix creation
Hello everybody. I am trying to reproduce a particular matrix in an elegant way. If I have jj1 <- structure(c(1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2, 3,1,2,3,1,2,3,1,2,3,2,3,1,2,3,1,2,3,1,2,3, 1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,3,1,2,3,1, 2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1, 2),.Dim = as.integer(c(9,9))) [ image(jj1) is good here ] then I can get this with
2009 May 29
1
data manipulation involving aggregate
hi all, I often have a data frame like this example data.frame(sq=c(1,1,1,2,2,3,3,3,3),area=c(1,2,3,1,2,3,1,2,3),habitat=c("garden","garden","pond","field","garden","river","garden","field","field")) for each "sq" I have multiple "habitat"s each with an associated "area". I
2009 Aug 19
2
how do i vectorize relational queries in R
I am basically trying to append a value(vector) to one dataframe using a relational value from another dataframe. Obviously, I can use a loop to accomplish this. However, is there a way to vectorize it? Example: > data <- data.frame(c(1,1,1,2,2,2,3,3,3),rep(2,9)); names(data) <- > c("Sample","Score") > meta <-
2004 Jul 22
2
Standard error of a sum
Folks, This is so simple is driving me crazy. It's not really an R question is more an Statistics question. I applied a chemical in 3 different events during a growing season. I took 3 samples in each event to estimate mean applied chemical. Thus, I can easily estimate means and st.err by event. I can then estimate the total chemical applied for the whole season by adding the 3 means
2009 Jul 31
2
merging two data frame with colomns of different length
Dear all, I am trying to merge two data frames based on a common column but for this common column both data frame do not have the same length and associated information. I checked previous exemples in the list but was not able to apply them in my case... Is someone know how to do that? Below is my code with the expected result: # data frame 1 Id1 <- c(1,1,1,2,2,2,3,3,3) Habit1 <-
2010 Mar 06
2
Plot interaction in multilevel model
I am trying to plot an interaction in a multilevel model. Here is some sample data. In the following example, it is longitudinal (i.e., repeated measures), so the outcome, score (at each of the three time points), is nested within the individual. I am interested in the interaction between gender and happiness predicting score. id <- c(1,1,1,2,2,2,3,3,3) age <-
2023 Oct 24
2
How to Calculate the Mean by Multiple Groups in R
Hello, I have a data frame with different groups (Time, Target, Conc) and each entry has a triplicate value of the measurements OD and ODnorm. How can I merge the triplicates into a single mean value? I tried the following: ``` df = data.frame(Time=rep(1, 9), Well=paste("A", 1:9, sep=""), OD=c(666, 815, 815, 702, 739, 795, 657, 705, 663),