search for: data2

Displaying 20 results from an estimated 638 matches for "data2".

Did you mean: data
2009 Nov 13
2
why the same values cannot be judged to be the same in R
...######## data1<-matrix(data=c(1,1.2,1.3,"3/23/2004",1,1.5,2.3,"3/22/2004",2,0.2,3.3,"4/23/2004",3,1.5,1.3,"5/22/2004"),nrow=4,ncol=4,byrow=TRUE) data1<-data.frame(data1);names(data1)<-c("areaid","x","y","date") data2<-matrix(data=c(1,1.22,1.32,1, 1.53, 2.34,1, 1.21, 1.37,1, 1.52, 2.35,2, 0.21, 3.33,2, 0.23, 3.35,3, 1.57, 1.31,3, 1.59, 1.33),nrow=8,ncol=3,byrow=TRUE) data2<-data.frame(data2);names(data2)<-c("areaid","x1","y1") data2$tag<-0 data1_1<-data1[1,...
2023 Jun 11
1
Problem with filling dataframe's column
Dear Rui; Many thanks for your email. I used one of your codes, "data2$LU[which(data2$Layer == "Level 12")] <- "Park"", and it works correctly for me. Actually I need to expand the codes so as to consider all "Levels" in the "Layer" column. There are more than hundred levels in the Layer column. If I use your provided co...
2023 Jun 11
1
Problem with filling dataframe's column
?s 22:54 de 11/06/2023, javad bayat escreveu: > Dear Rui; > Many thanks for your email. I used one of your codes, > "data2$LU[which(data2$Layer == "Level 12")] <- "Park"", and it works > correctly for me. > Actually I need to expand the codes so as to consider all "Levels" in the > "Layer" column. There are more than hundred levels in the Layer column. > If I...
2023 Jun 11
1
Problem with filling dataframe's column
...g to fill a column based on a specific value in another column of > a dataframe, but it seems there is a problem with the codes! > The "Layer" and the "LU" are two different columns of the dataframe. > How can I fix this? > Sincerely > > > for (i in 1:nrow(data2$Layer)){ > if (data2$Layer == "Level 12") { > data2$LU == "Park" > } > } > > > > Hello, There are two bugs in your code, 1) the index i is not used in the loop 2) the assignment operator is `<-`...
2008 Nov 05
2
how can I save the estimates of a regression model in a file?
Dear all I need some help with R. How can I save the estimates of a regression model in a file? here is what I did: 1) this is my regression model: fit1 <- lm(logmilk ~ logdays + days, data=data2) 2) however, I want to get the parameters estimates for each individual (by group): so i did the following: by(data2, list(data2$V2),function(.data2) lm(logmilk ~ logdays + days, data= .data2)) 3) Then to keep the estimates in a file I did: res1 <- by(data2, list(data2$V2),function(.data2) lm(...
2011 Nov 16
3
plotting a double y axis when x and y lengths differ
Hello All, Many thanks to the help I have received so far. Here is an example data set I hope to plot Data1 Year Data SE 1 2005 2 0.01 2 2006 4 0.01 3 2007 5 0.01 4 2008 2 0.01 5 2009 3 0.01 6 2010 6 0.01 Data2 Year Data SE 1 2006 32 1 2 2007 100 2 3 2008 60 4 4 2009 67 3 5 2010 8 1 Notice Data2 has one less years worth of data than Data1 (which is my problem) I am fond of using plotCI as it makes creating error bars and offsetting overlapping error bars so easy, and double y-axis plot...
2011 Jul 16
1
Fwd: construct boxplots from data with varying column widths
...gt;>> >>> function1,12.5 >>> function1,13.11 >>> function1,35.2 >>> ... > >> That is definitely to be preferred. Read that into R and show us the >> results of str on your R data object. > > Thanks for your suggestion. > >> str(data2) > 'data.frame': 1940170 obs. of 2 variables: > $ function.: Factor w/ 127 levels "fn_activities01_list",..: 102 > 102 102 102 102 102 102 102 102 102 ... > $ runtime : num 38.1 32.4 41.2 92.9 130.5 .. > >> head(data2) > function...
2004 Feb 04
5
Date Time Conversion problems...
...ot;Way, Shawn",1/2/2003,AP15043,1/2/2003,1/9/2003,JS ,1000 "Vo, Hoang",1/7/2003,SO17440,1/8/2003,12/31/2003,USFi-,3705 "Harrold, Paul",1/10/2003,AP15122,1/13/2003,1/14/2003,FishM,65.06 Old Code: library(lattice) data <- read.csv("h:\\list3.csv",header=TRUE) data2 <- data.frame(Name=data$UserName,Date=data$RequestDate,Vendor=data$Vendor,Cost= data$Total) data2$Date <- strptime(as.character(data2$Date),format="%m/%d/%Y") start <- strptime(c("1/01/2003"),format="%m/%d/%Y") end <- strptime(c("12/31/2003"),form...
2009 Nov 27
2
If condition using accessors
...me with one problem I've been struggling with for the last hours!! (Sorry if I'm using the wrong terminology as well!) I have a data matrix in which SIE is one of my variables. What I need to do now is to create a new variable (group) if a certain condition in SIE is met. I tried: if (data2$SIE < 50.646){ data2$group=as.factor("small") } which gives me "In if (data2$SIE < 50.646) { : the condition has length > 1 and only the first element will be used" and ifelse (data2$SIE < 50.64593, data2$group = as.factor("small"),data2$group = as.fac...
2008 Aug 21
1
problem merging two data sets ( one with a header and one without)
I have two set of data, Data1 and Data2 . Data1 has a header and Data2 does not. I would like to merge the two data sets after removing some columns from data2 . I am having a problem merging so I had to write and read final data and specify the ?header=F? so the merge can be done by?V1?. Is there a way to avoid this step. The problem...
2014 Nov 10
2
range () does not remove NA's with complete.cases() for dates (dplyr/mutate)
...<NA> <NA> 2007-10-10 5 5 2006-09-01 2005-08-10 <NA> <NA> 2006-09-01 6 6 2007-09-04 2011-10-05 <NA> <NA> 2011-10-05 7 7 2005-10-25 <NA> <NA> 2011-11-04 2011-11-04 > > # range of dates > > range(data2$mrjdate[complete.cases(data2$mrjdate)]) [1] "2004-11-04" "2009-10-24" > range(data2$cocdate[complete.cases(data2$cocdate)]) [1] "2005-08-10" "2011-10-05" > range(data2$inhdate[complete.cases(data2$inhdate)]) [1] "2005-07-07" "2011-10-13&q...
2023 Jun 11
2
Problem with filling dataframe's column
Dear R users; I am trying to fill a column based on a specific value in another column of a dataframe, but it seems there is a problem with the codes! The "Layer" and the "LU" are two different columns of the dataframe. How can I fix this? Sincerely for (i in 1:nrow(data2$Layer)){ if (data2$Layer == "Level 12") { data2$LU == "Park" } } -- Best Regards Javad Bayat M.Sc. Environment Engineering Alternative Mail: bayat194 at yahoo.com [[alternative HTML version deleted]]
2009 Nov 12
2
redundant factor levels after subsetting a dataset
...me with a numeric and a character variable. x=c(1,2,3,2,0,2,-1,-2,-4) md=c(rep("Miller",3), rep("Richard",3),rep("Smith",3)) data1=data.frame(x,md) #I subset this data.frame in a way such that one level of the character variable does not appear in the new dataset. data2=data1[x>0,] data3=subset(data1,x>0) #However, when I check the levels of the factor variable in the subset data frame, it still shows the levels that are now unused. unique(data2$md) unique(data3$md) #This leads to complications in table and tapply that I want to avoid. table(data2$md) t...
2009 Nov 06
1
probem on merge data
...t;5/22/2004"),nrow=4,ncol=4,byrow=TRUE) data1<-data.frame(data1) names(data1)<-c("areaid","x","y","date") data1 areaid x y date 1 1 1.2 1.3 3/23/2004 2 1 1.5 2.3 3/22/2004 3 2 0.2 3.3 4/23/2004 4 3 1.5 1.3 5/22/2004 data2<-matrix(data=c(1,1.22,1.32,1, 1.53, 2.34,1, 1.21, 1.37,1, 1.52, 2.35,2, 0.21, 3.33,2, 0.23, 3.35,3, 1.57, 1.31,3, 1.59, 1.33),nrow=8,ncol=3,byrow=TRUE) data2<-data.frame(data2) names(data2)<-c("areaid","x1","y1") data2 areaid x1 y1 1 1 1....
2010 Sep 06
1
combining collumns for data.frames
Hi This question is far less simple than the title suggests, please read carefully, thanks. I have 2 sets of data, both read into R >data1<-read.table ("1.txt", header=T, sep="\t") >data2<-read.table ("2.txt", header=T, sep="\t") >data1 Taxon stage1 stage2 stage3 stage4 T1 0 0 1 1 T2 0 1 1 0 T3 0 0 0 1 T4 1 0 0...
2013 Jun 10
4
Combining CSV data
Hello R community, I am trying to combine two CSV files that look like this: File A Row_ID_CR, Data1, Data2, Data3 1, aa, bb, cc 2, dd, ee, ff File B Row_ID_N, Src_Row_ID, DataN1 1a, 1, This is comment 1 2a, 1, This is comment 2 3a, 2,...
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 data1 to data2, and combine the data2a vector to the original data2, I'm still missing some rows. I need to get the 26 rows, and preferably with the first column...
2009 Nov 09
0
how to stop a loop in a sampling
...lows.### data1<-matrix(data=c(1,1.2,1.3,"3/23/2004",1,1.5,2.3,"3/22/2004",2,0.2,3.3,"4/23/2004",3,1.5,1.3,"5/22/2004"),nrow=4,ncol=4,byrow=TRUE) data1<-data.frame(data1);names(data1)<-c("areaid","x","y","date") data2<-matrix(data=c(1,1.22,1.32,1, 1.53, 2.34,1, 1.21, 1.37,1, 1.52, 2.35,2, 0.21, 3.33,2, 0.23, 3.35,3, 1.57, 1.31,3, 1.59, 1.33),nrow=8,ncol=3,byrow=TRUE) data2<-data.frame(data2);names(data2)<-c("areaid","x1","y1") id<-unique(data1$areaid) for (n i...
2008 May 14
4
Accessing items in a list of lists
Using R 2.6.2, say I have the following list of lists, "comb": data1 <- list(a = 1, b = 2, c = 3) data2 <- list(a = 4, b = 5, c = 6) data3 <- list(a = 3, b = 6, c = 9) comb <- list(data1 = data1, data2 = data2, data3 = data3) So that all names for the lowest level list are common. How can I most efficiently access all of the sublist items "a" indexed by the outer list names? For...
2010 Jan 05
3
R matching lat/lon pairs from two datasets?
...aset and use that rows data for calculations. I am using match, but this is finding the first match and not comparing the pair, how can I determine if the lat/lon are the same? See example below. Is there a better way to determine to a matching pair of lat/lon values? Example Datasets: > data2 V1 V2 V3 1 -123.76 47.82 8 2 -123.75 47.82 11 > data[1:2] V1 V2 1 47.82 -123.76 2 47.82 -123.75 3 47.82 -123.74 4 47.82 -123.73 #Subset of current R code : lat <- data$V1 lon <- data$V2 yrs <- c(1,2,5,10,25,50,100,200,500,1000) lon2 <- data2$V1 lat2 <-...