Displaying 20 results from an estimated 200 matches similar to: "Question about #1 zoo-faq"
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.
2017 Nov 08
3
Adding Records to a Table in R
Dear Eric,
Hope you are doing great. I also tried the following:
#First I created the complete date sequence
TransitDateFrame <- data.frame(TransitDate=seq(as.Date(dataset1[1,1]),
as.Date(dataset1[nrow(dataset1),1]), by = "month"))
#Then I did the merging
dataset1NEW <- merge(TransitDateFrame, dataset1, by="TransitDate",
all.x=TRUE)
Now it has, as expected the
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 operations
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
1
2017 Nov 08
0
Adding Records to a Table in R
Hi
Instead of attachments copy directly result of dput(TransitDateFrame) and dput(dataset1) to your email. Or, if your data have more than about 20 rows you could copy only part of it.
dput(TransitDateFrame[,1:20])
dput(dataset1[,1:20])
Only with this approach we can evaluate your data in all aspects and provide correct answer.
Cheers
Petr
> -----Original Message-----
> From: R-help
2009 Sep 22
2
Creating loops with strings
Hello. I'm trying to run a series of commands in two 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 <-
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,
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
2011 Jul 20
1
Latex Table for means and standard deviations in brackets
Hello all,
I am new to xtable. I have several datasets 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)
2012 Aug 09
2
correlating rows of two differently-sized data frames in R
Hello everyone,
I have two sets of data, 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
2009 Jul 15
1
loading multiple .Rdata and preserving variable names
Dear R-users,
I need to load outputs from multiple previous calculations into one R
session for comparison and (cross-)analysis. The previous calculations are
stored in different directories in .Rdata files (I don't know if this is the
best storage for later usage, but the previous project could be recalculated
and saved into different format, if needed, potentially.)
I can load consequently
2011 Jul 21
2
Latex Table Help on R
Hello everyone,
Peter (see my earlier post) recommended 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)
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
2010 Aug 19
4
Aggregate Help
Please let me know if this is or is not the right place to ask these
types of questions.
Warning: I am new to R by two days.
I have a simple dataset.
I have loaded the dataset successfully using the following code:
Filepath=(C:\temp\\pilot\dataset1.txt")
Pilot=read.table(filepath, header=TRUE)
Dataset1.txt is delimited and looks like this:
Date illness count
2006/01/01 derm 17
2006/01/01
2010 Mar 03
5
Matching rows in a Data set? I'm Stuck!!
Hi, I'm having (yet another) problem with R.
I have a few data sets that have this sort of format
dataset1
ID DATA
1234 value
2345 value
3456 value
dataset2
ID DATA
1111 value
2345 value
3333 value
What i really want to do is write an R script that says "if the ID of
dataset1 and 2 match (2nd row), print out that whole row into a new
dataset3". No idea how to do that though.
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
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 Jan 13
2
More issues with apply
Hi all,
Please consider the following:
DataSet1.. <-
data.frame(Bldgtype=c("SFDM","SFDM","SFDM","SFDM","SFDM","SFDM","APT"),
Taz=c("254","254","254","564","564","564","564"),stringsAsFactors = FALSE)
PeriodResType_Zx <-
2011 Nov 22
1
Rcmdr numSummary: means of multiple variables without grouping
Hello there,
when using the function numSummary in Rcmdr and selecting more than one
variable (without grouping), the grand mean across all variables is returned
for each variable instead of the mean of each single variable. However, this
happens only for the mean, and not for sd, quantiles and na.
This is the output:
> numSummary(dataset1 [,c("var1", "var2")],
2009 Feb 27
5
Filtering a dataset's columns by another dataset's column names
Hello all,
I hope some of you can come to my rescue, yet again.
I have two genetic datasets, and I want one of the datasets to have only the columns that are in common with the other dataset.
Here is a toy example (my real datasets have hundreds of columns):
Dataset 1:
Individual SNP1 SNP2 SNP3 SNP4 SNP5
1 A G T C A
2 T C A G T
3 A C T