search for: dataset2

Displaying 20 results from an estimated 38 matches for "dataset2".

Did you mean: dataset
2011 Jun 01
1
Replacing variables in one dataset with those from another
Hoping someone out there can help me...this seems like an easy task but I can't figure it out... I want to replace variables in one dataset (Dataset1) with a variable from another dataset (Dataset2). All the values for variables x1 and x2 in Dataset1 have a unique match to the variable uniquenum in Dataset2. For example, in Dataset1 grpnum A has a value of 343 for variable x1. In Dataset2, 343 will only be found once for variable uniquenum. I would like to create a new dataset where the v...
2012 Aug 09
2
correlating rows of two differently-sized data frames in R
...ta, with the following structure: DataSet1 Location Part Sample 1 Sample 2 A 1 value value A 2 value value A 3 value value B 1 value value DataSet2 Location Sample 1 Sample 2 A value value B value value C value value I would like to look at the correlations between DataSet1 and DataSet2, such that each row in Location A from DataSet1 is paired with...
2009 Nov 17
3
Perform operations on dataframes called with paste in loops
In a loop, I compose the name of a csv file using paste, then read it (e.g., dataset1.csv, dataset2.csv, etc). The name of the dataframe assigned to the imported csv is also composed with paste (e.g., dataset1, dataset2, etc.). Now I want to perform operations on the dataframes dataset1, dataset2, etc. However, the paste function only renders a string on which I can not, for example, do operation...
2012 Feb 09
1
sample points - sp package
When I make a sample in sp, for example a random samping of 5 points in dataset1: sample.dataset1=spsample(dataset1, n = 5, "random") I have a sp object for the selected sampling... My question is : How can I extract from dataset2 the points & data for the coordinates(sample.dataset1) ? The dataset2 would be an object with the same area and coordinate system, but I would like to extract for the coordinates of sample.dataset1 the data in each point for dataset2. I didn't found a way to do this in the sp package docs...
2011 Jul 21
2
Latex Table Help on R
...d the following script for finding the means and standard deviations and putting them in table form. However, I would like the standard deviations under the means in brackets. Can anyone check this code to see how this can be adjusted? library(xtable) dataset1 = matrix( c(1,2,3,4, 5, 6 ), 2 , 3) dataset2 = matrix( c(4,3,5,10, 1, 0), 2, 3) dataset <- rbind(dataset1,dataset2) #combine dataset means <- apply(dataset,1,mean) #calculate row means sds <- apply(dataset,1,sd) #calculate row standard deviation msd <- paste(round(means,2)," (",round(sds,2),")",sep=&q...
2006 Aug 02
1
questions on aggregate data
Dear friends, my question is how to aggregate dataset and the inverse manipulation. e.g.My dataset data structure1: x 1 1 2 3 3 data structure2: x freq 1 2 2 1 3 2 Then how to generate dataset2 from dataset1 and generate dataset1 from dataset2? e.g. dataset2 from dataset1 : x<-c(1,1,2,3,3) a<-tab(x) as.data.frame(a) *But i can't do the inverse manipulation:generate dataset1 from dataset2*, anybody can help me on the two different manipulations? Thanks a lot! -- Kind Reg...
2011 Jul 20
1
Latex Table for means and standard deviations in brackets
...in the form of matrices. Consider the following two simple datasets which are 2 x 3 matrices. The rows in both matrices have the same meaning. For example the first row of both matrices are variable 1 and the second row of both matrices are variable 2. dataset1 = matrix( c(1,2,3,4, 5, 6 ), 2 , 3) dataset2 = matrix( c(4,3,5,10, 1, 0), 2, 3) I would like to find the means and standard deviations in brackets for each data set in the form of a table that looks like: dataset1 dataset2 var1 2 3 (1.3) (2.5) var2 4 10 (2.3) (1...
2012 Oct 05
11
Calculating the mean in one column with empty cells
Hi all, I recently tried to calculate the mean and the median just for one column. In this column I have numbers with some empty cells due to missing data. So how can I calculate the mean just for the filled cells? I tried: mean(dataSet2$ac_60d_4d_after_ann[!is.na(master$ac_60d_4d_after_ann)], na.rm=TRUE) But the output was different to the calculation I died in Microsoft Excel. Thanks in advance, Felix -- View this message in context: http://r.789695.n4.nabble.com/Calculating-the-mean-in-one-column-with-empty-cells-tp4645135.h...
2017 Jun 21
0
Help/ Mathematics
Hi Ahmed, Your problem appears trivial as you have already specified the form of the calculation. Learn how to "extract" specified elements from a data structure: # first value sum(dataset1$NPP[dataset1$date >= date1 & dataset1$date <= date2]) # second value dataset2$biomass[dataset2$date == date2] - dataset2$biomass[dataset2$date == date1] # third value dataset3$littfall[dataset3$date == date2] Note that you may have to convert character strings to dates to do the above - see a function like "as.Date". Obviously I do not know the actual names of yo...
2012 Jan 13
2
More issues with apply
...ot;,"254","254","564","564","564","564"),stringsAsFactors = FALSE) PeriodResType_Zx <- tapply(as.character(DataSet1..$Bldgtype), as.character(DataSet1..$Taz), table) PeriodResType_Zx $`254` SFDM 3 $`564` APT SFDM 1 3 DataSet2.. <- data.frame(Bldgtype=c("SFDM","SFDM","SFDM","SFDM","SFDM","SFDM"), Taz=c("254","245","564","564","564","564")) PeriodResType_Zx <- tapply(DataSet2..$Bldgtype, DataSet2.....
2009 Mar 27
2
Remove error data and clustering analysis
...476, 128367, 470, 513, 466, 476,482, 1201, 469, 502; I had so many datasets like that. Basically, every dataset can classify one or two clusters (no more than 2), meanwhile, there have error data points, for example, 12836 is error data point in Dataset 1; and 128367, 1201 is error data points in dataset2. The clustered data is following the normal distribution, the standard deviation was known. That?s mean the one cluster is following the normal distribution when the dataset classified one cluster like dataset2; the two clusters are following the normal distribution respectively when the dataset c...
2009 Sep 22
2
Creating loops with strings
...wo different datasets. For make it efficient I want to make a loop for it. Until now the only command for loops i found it's the for() command it's only for series of numbers and not a series of strings, witch it's what i'm needing. It would be something like this for(i in dataset1 dataset2) { i <- read.dta("dataset1.dta") ls() summary(i) str(i) attach(i) } I hope the idea it's clear. I'm using 2.9.1 Windows Version of R. Thanks. -- View this message in context: http://www.nabble.com/Creati...
2017 Jun 21
4
Help/ Mathematics
Hi R users, I need your help to write a code in r that does the following calculation from three different datasets; ac = 1/sum (NPP from date 1 to date 2, dataset=1) * (biomass at date 2 -biomass at date 1, dataset = 2) + (littfall at date 2, dataset=3). all the dates are in yr-month-day format. Which library or function Should I use to tell R do these calculations of these variables at
2012 May 04
2
Can't import this 4GB DATASET
...nt in each row is separated by and uneven number of (what seem to be) spaces (maybe TAB? not sure). Further, there are some rows that are "incomplete", i.e. there's missing elements. Take the first 29 rows of "dataset.txt" into a separate data file, let's call it "dataset2.txt". read.table("dataset2.txt",skip=5) gives the perfect table that I want to end up with, except I want it with the 4GB data through bigmemory, ff or filehash. read.table('dataset2.txt',skip=5) V1 V2 V3 V4 V5 V6 V7 V8 V9 1 10001 01/09/1986 11...
2011 Oct 11
1
filtering rows
Hi everyone, I've got two data sets as below. My question now is: how can I use Dataset2 as a filter for Dataset1? My goal is just to keep the rows of Dataset1 where the first column (Date) matches the Dates in Dataset2. I would appreciate any solutions to this issue. Many thanks! S.B. Dataset1: Date A B C D...
2013 Mar 07
1
create vector from indices interpolated values
Readers, Is it possible to create a plot command based upon the indices of missing values in a data set? dataset1<-read.table(text=' 10 2 20 NA 30 5 40 7 50 NA 60 NA 70 2 80 6 90 NA 100 9 ') dataset2<-read.table(text=' 0.2 0.4 0.1 0.9 0.2 0.3 1.1 0.7 0.9 0.6 0.4 ') The 'approx' function is used to obtain the interpolated values for 'NA' in dataset1. dataset1interpolatedvalues<-approx(dataset1,y=NULL,xout=dataset1$V1[is.na(dataset1$V2)]) dataset1interpolatedvalue...
2011 May 25
1
Subtracting rows by id
Dear R users, I have two datasets: id1 <- c(rep(1,10), rep(2,10), rep(3,10)) value1 <- sample(1:100, 30, replace=TRUE) dataset1 <- cbind(id1,value1) id2 <- c(1,2,3) subtract.value <- c(1,3,5) dataset2 <- cbind(id2, subtract.value) I want to subtract the number of rows in the subtract.value that corresponds to the id value in dataset1. So for the 1 in id1, I want to remove the first row, for 2 in id1 I want to remove the first 3 rows, for 3 in id1 I want to remove the first 5 rows, fin...
2004 Mar 09
1
vector extraction
Hello, I could need some help on this one: >From the data.frame "Test.dataset2" below (TSCS data for 151 "countries.to.map" for "year" 1973-95; each "country.to.map" is described by a unique code), I would like to extract a vector "color" that for each "country.to.map" takes on the value of "dv" (a categorical v...
2009 Jul 15
1
loading multiple .Rdata and preserving variable names
...sequently multiple .Rdata files (in which variable names are identical), but I don't know how to preserve variables from these files or make them unique. I would imagine pointing them as in a list: # loading 2, max. 4 outputs of previous calculations load(DataSet1) # VariableA is present load(DataSet2) # VariableA is present, too # both VraiableA listed and present DataSet1$VariableA$parameters DataSet2$VariableA$parameters But what is the way to feed all variables into a list? Or more generally, what is an efficient way to work with multiple separate outputs which one would like to compare?...
2011 May 27
1
Put names in the elements of lapply result
Dear list, I am running some linear regressions through lapply, >lapply(c('EMAX','EC50','KOUT','GAMMA'),function(x)confint(lm(get(x)~RR0,dataset2))) I got results like [[1]] 2.5 % 97.5 % (Intercept) 0.6595789212 0.8821691261 RR0 -0.0001801771 0.0001489083 [[2]] 2.5 % 97.5 % (Intercept) -63.83694930 76.5489503 RR0 -0.01515098 0.1924006 [[3]] 2.5 %...