Displaying 20 results from an estimated 11000 matches similar to: "Creation of a new data frame"
2010 Mar 24
1
Filling a grid based on existing data
Dear all,
I currently have a data frame of dimensions 18556 rows by 19 columns. I want to convert this into a grid of dimensions 720 rows by 360 columns. The problem in this case is that not all rows in the initial data frame are complete (there are gaps).
Therefore I am perhaps looking for a way of filling a 720 x 360 grid by reading in all values in each row until one is encountered which does
2009 Aug 14
4
Assigning values based on a separate reference (lookup) table
Dear R Users,
I have a data frame of 360 rows by 720 columns (259200 values). For each value in this grid I am hoping to apply an equation to, to generate a new grid. One of the parts of the equation (called 'p') relies on reading from a separate reference table. This is Table 4 at: http://www.fao.org/docrep/s2022e/s2022e07.htm#3.1.3%20blaney%20criddle%20method (scroll down a little).
2006 Jan 23
1
Sample rows in data frame by subsets
Hi,
I need to resample rows in a data frame by subsets
L3 <- LETTERS[1:3]
d <- data.frame(cbind(x=1, y=1:10), fac=sample(L3, 10, repl=TRUE))
x y fac
1 1 1 A
2 1 2 A
3 1 3 A
4 1 4 A
5 1 5 C
6 1 6 C
7 1 7 B
8 1 8 A
9 1 9 C
10 1 10 A
I have seen this used to sample rows with replacement
d[sample(nrow(d), replace=T), ]
x y fac
7 1 7 B
2
2005 Jun 10
4
data.frame to character
Hi,
Excuse me for this simple question.
How to convert as.data.frame to as.character?
?data.frame
> L3 <- LETTERS[1:3]
> L10 <- LETTERS[1:10]
> d <- data.frame(cbind(x=c("XYZ"), y=L10), fac=sample(L3, 10, repl=TRUE))
> d
x y fac
1 XYZ A A
2 XYZ B A
3 XYZ C A
4 XYZ D A
5 XYZ E B
6 XYZ F C
7 XYZ G A
8 XYZ H C
9 XYZ I B
10 XYZ
2009 Jan 06
2
Converting data frame to symmetric matrix
Dear Sir or Madam,
I have the following data frame (which is just a toy example of my
larger dataset)
L3 <- LETTERS[1:3]
x=c(1,1,2,2,3,3,4,4,5,5)
y=1:10
d <- data.frame(cbind(x,y), fac=sample(L3, 10, replace=TRUE))
This data frame produces the following output
x y fac
1 1 1 C
2 1 2 C
3 2 3 B
4 2 4 B
5 3 5 C
6 3 6 B
7 4 7 B
8 4 8 C
9 5 9 B
10 5
2006 Apr 06
3
convert a data frame to matrix - changed column name
I have a question, which very easy to solve, but I can't find a solution.
I want to convert a data frame to matrix. Here my toy example:
> L3 <- c(1:3)
> L10 <- c(1:6)
> d <- data.frame(cbind(x=c(10,20), y=L10), fac=sample(L3, + 6, repl=TRUE))
> d
x y fac
1 10 1 1
2 20 2 1
3 10 3 1
4 20 4 3
5 10 5 2
6 20 6 2
> is.data.frame(d)
[1] TRUE
> sapply(d,
2010 Feb 09
2
Resampling a grid to coarsen its resolution
Dear all,
I have a grid (data frame) dataset at 0.5 x 0.5 degrees spatial resolution (720 columns x 360 rows; regular spacing) and wish to coarsen this to a resolution of 2.5 x 2.5 degrees. A simple calculation which takes the mean of a block of points to form the regridded values would do the trick. Values which should be excluded from the calculation are -9999 (unless all points within a block
2010 Jan 22
1
Looping multiple dimensions
Dear all,
I have 30 arrays, each with dimensions 720,360,12. The naming format for each of these 30 objects is: mrunoff_5221, mrunoff_5222... mrunoff_5250.
For example:
> str(mrunoff_5221)
? num [1:720, 1:360, 1:12] NA NA NA NA NA NA NA NA NA NA ...? (the initial NA's are nothing to worry about)
I am looking for a way by which I can extract each of the third dimension of these grids
2009 Aug 23
3
When factor is better than other types, such as vector and frame?
Hi,
It is easy to understand the types vector and frame.
But I am wondering why the type factor is designed in R. What is the
advantage of factor compare with other data types in R? Can somebody
give an example in which case the type factor is much better than
other data types?
Regards,
Peng
2015 Jul 14
2
[LLVMdev] [llvm] [libunwind] r207467 misprint
Hi Nick!
In r207467 you added code(libunwind: DwarfInstructions.hpp):
assert(lastReg <= (int)cieInfo.returnAddressRegister
&& "register range does not contain return address
register");
for (int i = 0; i <= lastReg; ++i) {
.....
else if (i == (int)cieInfo.returnAddressRegister)
There is misprint here: lastReg should be >=
2006 Sep 27
1
Impossible to merge with a zero rows data frame?
I'm trying to merge two data frames. One of them is a zero rows data
frame.
I'm using the merge parameter 'all.x = TRUE' so I'd expect to obtain all
the rows of x. In fact the merge help says:
all.x: logical; if 'TRUE', then extra rows will be added to the
output, one for each row in 'x' that has no matching row in
'y'. These rows
2009 Aug 08
4
how to get id of other table
Hi All,
I have a doubt regarding join tables
I''m having 2 models
1)Fac
2)Cont
and both models have " has and belong to many" relationships
so there are 3 tables
1)facs
2)conts
3)conts_facs
then i''m fetching the data in controller as
@conts=Cont.find(:all])
@cfacs=Fac.all(:joins=>:conts, :select=>"facs.name")
but i dont know how to get the
2013 Jan 17
3
Colors in interaction plots
Hi,
I am trying to plot an interaction.plot with different color for each
level of a factor. It has an erratic behavior.
For example, it works for the first interaction.plot below, with the
example from the ALDA book, but not with the other plots, from the NPK
dataset:
# from http://www.ats.ucla.edu/stat/r/examples/alda/ch2.htm
tolerance <-
2006 Apr 14
5
vector-factor operation
I found myself wanting to average a vector [vec] within each level of a
factor [Fac], returning a vector of the same length as vec. After a
while I realised that
lm1 <- lm(vec ~ Fac)
fitted(lm1)
did what I want.
But there must be another way to do this, and it would be good to be
able to apply other functions than mean() in this way.
Cheers, Murray
--
Dr Murray Jorgensen
2005 Mar 31
1
Contingency table: logistic regression
Hi,
I am analyzing a data set with greater than 1000 independent cases
(collected in an unrestricted manner), where each case has 3 variables
associated with it: one, a factor variable with 0/1 levels (called XX),
another factor variable with 8 levels (X) and a third response variable
with two levels (Y: 0/1). I am trying to see if X1 has an effect on the
relationship between X2 and the
2013 Dec 14
2
Change factor levels
Suppose I have a dataframe 'd' defined as
L3 <- LETTERS[1:3]
d0 <- data.frame(cbind(x = 1, y = 1:10), fac = sample(L3, 10, replace
= TRUE))
(d <- d0[d0$fac %in% c('A', 'B'),])
x y fac
2 1 2 B
3 1 3 A
4 1 4 A
5 1 5 A
6 1 6 B
8 1 8 A
Even though factor 'fac' in 'd' only has 2 levels, but it seems to bear the
birthmark
2012 Jan 02
4
Create variable with AND IF statement
Hello,
I'm using SPSS at work but really would like to switch to R. Right now I'm
trying to learn R in reproducing calculations I did with SPSS but am stuck
with something that is quite simple and comprehensible in SPSS-Syntax:
IF (variable1.fac = 0 AND variable2.num = 0) variable3=1.
IF (variable1.fac = 0 AND variable2.num >= 1) variable3=2.
IF (variable1.fac = 1 AND variable2.num =
2009 Jun 03
1
Need help understanding output from aov and from anova
Hi all,
I noticed something strange when I ran aov and anova.
vtot=c(7.29917, 7.29917, 7.29917) #identical values
fac=as.factor(c(1,1,2)) #group 1 has first two elements, group 2 has
the 3rd element
When I run:
> anova(lm(vtot~fac))
Analysis of Variance Table
Response: vtot
Df Sum Sq Mean Sq F value Pr(>F)
fac 1 1.6818e-30 1.6818e-30 0.3333 0.6667
Residuals 1
2010 Apr 21
5
Bugs? when dealing with contrasts
R version 2.10.1 (2009-12-14)
Copyright (C) 2009 The R Foundation for Statistical Computing
ISBN 3-900051-07-0
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
Natural language support but running in an English locale
R is a collaborative project with
2010 Mar 29
2
Samba SMB throughput
Hello everyone,
Quoting from Samba Team Blog #2 (25 Sept 2009):
"Volker showed how to get more than 700MB/sec from Samba using
smbclient and a modern Samba server, which shows what you can
really do when you understand the protocol thoroughly and don't feel
you have to invent a new one (SMB2 :-)."
Would it be possible to get a complete accounting of how this was achieved?
Thanks,