thx for ur fast responds.
but sorry for asking stupid, i am a turn beginner of R (just trying it out
3 months, and i am taking my first course about it)
so, to tackle this questions,
i was told to use nested design method,
could you actually show me how would u attempt this problem?
(a) Determine
Aloha all,
I have a data frame with 4 columns. The first three are factors (f1,
f2, f3) and the fourth is numeric. I'd like to explore these data
using median polish. To do that I plan to use medpolish() on the
matrix[f1,f2xf3], then medpolish on the resulting matrix[f2,f3]. This
be in arbitrary order.
Bill Venables
http://www.cmis.csiro.au/bill.venables/
-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On
Behalf Of Thomas S. Dye
Sent: Monday, 23 March 2009 7:36 AM
To: r-help@r-project.org
Subject: [R] data frame to array
so i am having this question
what should i do if the give data file (.txt) has 4 columns, but different
lengths?
how can i read them in R?
any idea for the following problem?
Gas consumption (1000 cubic feet) was measured before and after insulation
was put into
a house. We are interested in
If the input file has a separator other than a space (e.g., tabs or
commas) then you can read it is and the missing data will be NAs and
you can decide how to handle it. If it does not have a separator,
then maybe you can read it in with read.fwf. Otherwise when you read
it in, you can tell the
This works with the example. If the real data is different it may not
work. To run the example below just copy and paste it into R.
To run with the real data replace textConnection(Lines) with
insulation.txt everywhere.
Lines - Before insulAfter insul.
tempgas tempgas
-0.8
On Sat, Mar 21, 2009 at 5:13 PM, UBC cheong0...@hotmail.com wrote:
so i am having this question
what should i do if the give data file (.txt) has 4 columns, but different
lengths?
how can i read them in R?
any idea for the following problem?
Gas consumption (1000 cubic feet) was measured
I think I am overlooking a call or concept in R to help me easily and quickly
restructure my data.frame:
Sometimes the data I receive looks like:
VariableName, Run1, Run2, Run3, Location
temp, 15.0, 16.0, 17.0, There
And other times it looks like:
VariableName, Run, Location
look at package reshape there is a cool little function input that
once you get the hang of is handy.
On Mon, Mar 9, 2009 at 5:50 PM, Jason Rupert jasonkrup...@yahoo.com wrote:
I think I am overlooking a call or concept in R to help me easily and quickly
restructure my data.frame:
Sometimes
.
--- On Mon, 3/9/09, stephen sefick ssef...@gmail.com wrote:
From: stephen sefick ssef...@gmail.com
Subject: Re: [R] Data Restructuring Question
To: jasonkrup...@yahoo.com
Cc: R-help@r-project.org
Date: Monday, March 9, 2009, 9:00 PM
look at package reshape there is a cool little function input that
once
How do I do a data envelopment analysis in R...provide me with the step by
step procedure for that..thanks in advance...
Arup
--
View this message in context:
http://www.nabble.com/Data-Envelopment-Analysis-in-R-tp22199360p22199360.html
Sent from the R help mailing list archive at Nabble.com.
Dear R-list members,
I have a data file with thousands of lines (cases), where each line
contains the values of several variables. I would like to separate
these lines in small groups, with each group followed by a blank
line, to ease the visual inspection of the data in some situations.
I am
Hi all,
I've used R for basic programming and data management for a few years now. One
of the things that I think could be improved is the data editor.
Its a great feature and I use it alot by calling edit(data.frame); very useful
to see if what you tried to do actually worked.
However, one
Hi !
I am using Tinn R data editor.
This is wonderful and also thin one. Try this. I guess, yu will find what
you are looking for.
Regards,
Suresh
Simon Pickett-4 wrote:
Hi all,
I've used R for basic programming and data management for a few years now.
One of the things that I think
There are three different data editors, so you will need to start by
telling us your OS (and the other details asked for in the posting
guide).
But this is really an R-devel question, and that is where offers to
work on this (or to sponsor such work) should be posted.
As the author of one
Dear R Helpers:
I have a data set where the unit of observation is country-year. I would like
to generate a new data set based on some inclusionary (exclusionary) criteria.
Here is an example of the type of data that I have.
df-data.frame(cbind(country=c(rep(Angola, 9), rep(Burundi, 7),
Is the what you are after:
df-data.frame(cbind(country=c(rep(Angola, 9), rep(Burundi, 7),
+ rep(Chad, 13)), year=c(1975:1983, 1989:1995, 1965:1977)),
+ war=c(rep(1,2), rep(0,5), rep(1,2), rep(1,2), rep(0,2), rep(1,3),
+ rep(1,4), rep(0,6), rep(1,3)))
x - split(df, df$country)
Hello Jim:
Yes, that's exactly what I needed!
Thank you!
Josip
- Original Message -
From: jim holtman jholt...@gmail.com
To: Josip Dasovic j_daso...@sfu.ca
Cc: r-help@r-project.org
Sent: Tuesday, January 27, 2009 4:45:31 PM GMT -08:00 US/Canada Pacific
Subject: Re: [R] Data Frame
Dear Rxperts,
I would like to convert the following:
StudyStudy.NameParameterDestSrcFormValueMin
MaxFSD
1NT_1-0BFK(03)03A0.128510.0E+001.
0.41670E-01
1NT_1-0BFL(00,03)0003D0.36577
1NT_1-0BF
Although the message is rather unreadable, I guess you want to look at
?reshape.
Uwe Ligges
oscar linares wrote:
Dear Rxperts,
I would like to convert the following:
StudyStudy.NameParameterDestSrcFormValueMin
MaxFSD
1NT_1-0BFK(03)03A
Dear Rxperts,
I have a varaibles data file that looks like this
p(1) 10
p(1) 3
p(1) 4
p(2) 20
p(2) 30
p(2) 40
p(3) 4
p(3) 1
p(1) 2
I cannot process these data with R because it does not like the parentheses.
How can I get these to look like:
p1 10
p1 3
p1 4
p2 20
p2 30
p2 40
p3 4
p3 1
p3 2
Does this give you what you want:
x - read.table(textConnection(p(1) 10
+ p(1) 3
+ p(1) 4
+ p(2) 20
+ p(2) 30
+ p(2) 40
+ p(3) 4
+ p(3) 1
+ p(1) 2), as.is=TRUE)
# remove parenthesis
x$V1 - gsub([()], , x$V1)
x
V1 V2
1 p1 10
2 p1 3
3 p1 4
4 p2 20
5 p2 30
6 p2 40
7 p3 4
8 p3 1
9 p1 2
? gsub
gsub(\\(|\\), , var)
You can then read.table on a textConnection.
read.table(textConnection(gsub(\\(|\\), , var) ))
V1 V2
1 p1 10
2 p1 3
3 p1 4
4 p2 20
5 p2 30
6 p2 40
7 p3 4
8 p3 1
9 p1 2
On Jan 18, 2009, at 12:13 PM, oscar linares wrote:
Dear Rxperts,
I have a varaibles
Hi,
I ran into this issue previously and managed to solve it, but I've
forgotten how and am getting frustrated...
I have a data frame (see below) with scandinavian characters in R
(2.7.1) running on a Win Xp-computer. I save the data frame in an
RData-file on a usb stick, and load() it in R
Hi,
On my system (see below), it works fine (inputing the code below at
the R prompt). Make sure that the encoding of the input file is
encoded UTF-8.
Rgds,
Ivan
sessionInfo()
R version 2.8.1 Patched (2009-01-14 r47602)
i386-apple-darwin9.6.0
locale:
Dear all-
I have a dataset (see a sample below - but the whole dataset is June
2005 - June 2008). The LST format is YYMMDDHHmm and I would like to
get the hourly average of the mph for the summer months (spanning all
years). I have been trying to use aggregate but am not having much
success
Does this do it for you:
# quick and dirty -- remove the 'mm' from the data and then aggregate
x$hours - (x$LST %/% 100) * 100
aggregate(x$mph, list(x$hours), mean)
Group.1x
1 50601 13.82500
2 506010100 17.55000
3 506010200 23.04167
4 506010300 22.0
You can also 'filter'
Use read.zoo and aggregate.zoo from zoo and
months, hours and as.chron from chron.
Note that we must read in col 1 as character to ensure leading
zeros don't get dropped. There are two mph columns and it is
assumed you want both:
Lines - LST inch mphDeg DegF DegF%volts
On Mon, Dec 08, 2008 at 09:34:35PM -0800, Feanor22 wrote:
Hi experts of R,
Are there any functions in R to test a univariate series for long memory
effects, structural breaks and time reversability?
I've found for ARCH effects(ArchTest), for normal (Shapiro.test,
KS.test(comparing with
Hi experts of R,
Are there any functions in R to test a univariate series for long memory
effects, structural breaks and time reversability?
I've found for ARCH effects(ArchTest), for normal (Shapiro.test,
KS.test(comparing with randn) and lillie.test) but not for the above
mentioned.
Where can
hi there
I have a dataframe
abc 123 234
abc 234 456
def 567 234
elm 123 456
klm 234 678
klm 465 678
I want the unique of first colum along with the values in colum 2 and 3.I By
default it will select the first element for the unique so my out put should
be
abc 123 234
def 567 234
elm 123 456
I have the same problem. If the first row has more columns than later rows,
the fill=TRUE works; however when the first row has LESS columns than later
rows, R won't read in more columns than the length of the first row. Anyone
has solutions?
Yanni
Marc Schwartz wrote:
on 11/11/2008 03:39
This was the scenario that Phoebe posted about. Her data was:
2.93290e-06 1.17772e-06 -0.645205 rs2282755
3.07521e-06 3.14000e-04 0.412997 rs1336838
4.84017e-06 2.18311e-01 0.188669 rs2660664 rs967785
9.77861e-06 7.04740e-02 0.294653 rs2660664
1.22767e-05 1.56325e-05 0.569826 rs6870519
Dear all,
I'm using R2.8 version, and am trying to do NMDS and calculate other
diversity indices in vegan package.
The problem is that it works with a small set of data (43 X 23; row by
column), but the following error message comes up with a larger data set (43
X 104) (it seems not large to me
Hi Keun-Hyung,
Can you send the data (off list) to me or at least show what
str(gh1)
produces, and show us the output from
require(vegan)
sessionInfo()
Without that it is difficult to help.
G
On Tue, 2008-11-11 at 17:19 +0900, [EMAIL PROTECTED] wrote:
Dear all,
I'm using R2.8 version,
Hi all,
I have problem reading in a text file as follow.
The following data has not column header. I tried the following
command but failed,
temp-read.table(data.txt,header=F)
An error message stated that line 3 did not have 4 elements.
0.293290E-05 0.117772E-05 -0.645205
on 11/11/2008 03:39 PM phoebe kong wrote:
Hi all,
I have problem reading in a text file as follow.
The following data has not column header. I tried the following
command but failed,
temp-read.table(data.txt,header=F)
An error message stated that line 3 did not have 4 elements.
See ?ave and ?seq_along
DF - data.frame(Name = c(Mary, Mary, Mary, Sam, Sam,
John, John, John, John), stringsAsFactors = FALSE)
DF$index - ave(1:nrow(DF), DF$Name, FUN = seq_along)
On Sat, Nov 8, 2008 at 5:43 AM, jie feng [EMAIL PROTECTED] wrote:
Hi, there,
I have a simple data
Hi, there,
I have a simple data manipulation question for you. Thank you for your help!
Suppose that I have this data about people appearing in a class
Mary
Mary
Mary
Sam
Sam
John
John
John
John
Then I want to find out what exact time(s) the student appears at the
moment such as
Mary 1
one way is with ave(), e.g.,
dat - data.frame(name = rep(c(Mary, Sam, John), c(3,2,4)))
dat$freq - ave(seq_along(dat$name), dat$name, FUN = seq_along)
dat
I hope it helps.
Best,
Dimitris
jie feng wrote:
Hi, there,
I have a simple data manipulation question for you. Thank you for your
Dear R-listers,
I am a relatively inexperienced R-user currently migrating from Stata. I
am deeply frustrated by this data manipulation question: I know how I
could do it in Stata, but I cannot make it work in R.
I have a data frame of hospitalization data where each row represents an
admission.
How about:
id - c(rep(a,4),rep(b,2), rep(c,5), rep(d,1))
start - c(c(0,6,17,20),c(0,1),c(0,5,10,11,50),c(0))
stop - c(c(6,12,20,30),c(1,10),c(3,10,11,30,55),c(6))
data - data.frame(id,start,stop)
f - function(data){
m - match(data$start,data$stop) + 1
if (length(m)==1
On Thu, Nov 6, 2008 at 4:23 PM, Peter Jepsen [EMAIL PROTECTED] wrote:
Here is an example:
id - c(rep(a,4),rep(b,2), rep(c,5), rep(d,1))
start - c(c(0,6,17,20),c(0,1),c(0,5,10,11,50),c(0))
stop - c(c(6,12,20,30),c(1,10),c(3,10,11,30,55),c(6))
data - as.data.frame(cbind(id,start,stop))
data
special cases outside my small example dataset.
Thank you again!
Peter.
-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
On Behalf Of bartjoosen
Sent: 6. november 2008 11:31
To: r-help@r-project.org
Subject: Re: [R] Data manipulation question
How about:
id - c(rep(a,4
?
Thanks,
~D
--
View this message in context:
http://www.nabble.com/how-to-cite-R-data-sets-tp20325205p20325205.html
Sent from the R help mailing list archive at Nabble.com.
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
built into R as a means of showing an example of how my analysis will
be carried out. I know that citation(package) will produce a citation for
any R package, but is there a proper way to cite this data set?
Thanks,
~D
--
View this message in context:
http://www.nabble.com/how-to-cite-R-data
Hello,
I'd like to pass a column name as the argument for a function, but I'm
getting NULL as a return value. Any suggestions? Thanks.
d - data.frame(cbind(x=1, y=1:10))
d
x y
1 1 1
2 1 2
3 1 3
4 1 4
5 1 5
6 1 6
7 1 7
8 1 8
9 1 9
10 1 10
testing - function(var) {
+ tst
, September 26, 2008 3:10 PM
To: r-help@r-project.org
Subject: [R] data frame column name as a function argument
Hello,
I'd like to pass a column name as the argument for a function, but I'm
getting NULL as a return value. Any suggestions? Thanks.
d - data.frame(cbind(x=1, y=1:10))
d
x y
1 1
Hello,
maybe it is better if you copy an extract of your dataset file in the
message because the attached file did'nt seem to get through.
Margherita
2008/9/14 Ndoh Innocent (Holy) [EMAIL PROTECTED]
Greetings dear friends.
Please, I really find problems having the program read my datasets
Greetings dear friends.
Please, I really find problems having the program read my datasets (here
attached).
Have converted datasets to csv, imported but always not reaching the target.
Would be very happy if some one out can help me on time.
Thanks
Ndoh Mbue Innocent
International corporation
Dear All,
I have a data set containing 2,122,164 records and 38198952 fields.
I can not import this data due to momory problem.
Is there a way to solve this problem?
Thanks
[[alternative HTML version deleted]]
__
R-help@r-project.org
? Chapter 4
of the R Data Import/Export Manual may help.
2. Failing that, buy more memory for your PC.
Regards,
Richie.
Mathematical Sciences Unit
HSL
ATTENTION:
This message contains privileged and confidential inform
You can use a connection and read a portion of the data in at a time
and process it. Do you need all the data at once? If so, I would
agree that you either need more memory (and possibly a 64-bit version
of the system), or you come up with a different approach to your
processing. You have not
I have a data frame containing sequences and I am interested in changing a few
sequences in a window and the swapping the original sequence back after I have
completed my analysis.
My temporary data frame that I am creating seq.in.window does not like the way
I am making me assignment. The
I was having a problem with a little simple function I wrote in R and I think
the problem was that R is representing fractional numbers in binary floating
point and not decimal notation, so sometimes I was having extra data points
counted. Is there a way to cast a number stored in a variable as
faq 7.31
On Fri, Aug 15, 2008 at 9:16 AM, Amanda1988 [EMAIL PROTECTED] wrote:
I was having a problem with a little simple function I wrote in R and I think
the problem was that R is representing fractional numbers in binary floating
point and not decimal notation, so sometimes I was having
working with in a clean, easy to
read,
separate window.
A friend showed me how to do something like I want with edit(). I
can view
the matrix in the 'R Data Editor':
For a sample matrix:
mat=matrix(1:15,ncol=3)
mat
[,1] [,2] [,3]
[1,]16 11
[2,]27 12
[3,]38 13
, at 7:29 PM, Rachel Schwartz wrote:
Hi,
I would like to view matrices I am working with in a clean, easy to read,
separate window.
A friend showed me how to do something like I want with edit(). I can
view
the matrix in the 'R Data Editor':
For a sample matrix:
mat=matrix(1:15,ncol=3)
mat
Hi,
I would like to view matrices I am working with in a clean, easy to read,
separate window.
A friend showed me how to do something like I want with edit(). I can view
the matrix in the 'R Data Editor':
For a sample matrix:
mat=matrix(1:15,ncol=3)
mat
[,1] [,2] [,3]
[1,]16
view
the matrix in the 'R Data Editor':
For a sample matrix:
mat=matrix(1:15,ncol=3)
mat
[,1] [,2] [,3]
[1,]16 11
[2,]27 12
[3,]38 13
[4,]49 14
[5,]5 10 15
look=function(x) invisible(edit(x))
look(mat)
That opens the 'R Data Editor
your last sentence. Maybe
there's a better option?
Rachel Schwartz wrote:
Hi,
I would like to view matrices I am working with in a clean, easy to read,
separate window.
A friend showed me how to do something like I want with edit(). I can
view
the matrix in the 'R Data Editor
to view matrices I am working with in a clean, easy
to read,
separate window.
A friend showed me how to do something like I want with edit().
I can view
the matrix in the 'R Data Editor':
For a sample matrix:
mat=matrix(1:15,ncol=3
, Aug 1, 2008 at 10:29 AM, Rachel Schwartz [EMAIL PROTECTED] wrote:
Hi,
I would like to view matrices I am working with in a clean, easy to read,
separate window.
A friend showed me how to do something like I want with edit(). I can view
the matrix in the 'R Data Editor':
For a sample
in the 'R Data Editor':
For a sample matrix:
mat=matrix(1:15,ncol=3)
mat
[,1] [,2] [,3]
[1,]16 11
[2,]27 12
[3,]38 13
[4,]49 14
[5,]5 10 15
look=function(x) invisible(edit(x))
look(mat)
That opens the 'R Data Editor' with mat loaded
I have two vectos (list) that represent a years of data. Each row is
represented by the day of year and the quantity that was sold for that day. I
would like to form a new vector that is the difference between the two years of
data. A sample of A (and similarly B) looks like:
A[1:5,]
Look at merge.zoo
library(zoo)
dput(A)
structure(list(DayOfYear = 1:5, x = c(1429L, 3952L, 3049L, 2844L,
2219L)), .Names = c(DayOfYear, x), class = data.frame, row.names = c(1,
2, 3, 4, 5))
B - A[c(2,4),]
Az - zoo(A$x, A$DayOfYear)
Bz - zoo(B$x, B$DayOfYear)
merge(Az, Bz, fill = 0)
Az
For the last statement we may prefer this
so it stays a zoo object:
m - merge(Az, Bz, fill = 0)
m[,1] - m[,2]
12345
14290 30490 2219
On Sat, Jul 26, 2008 at 5:53 PM, Gabor Grothendieck
[EMAIL PROTECTED] wrote:
Look at merge.zoo
library(zoo)
dput(A)
Here is a second solution. This one uses sqldf instead of zoo:
library(zoo)
sqldf(select A.x - ifnull(B.x, 0) from A left join B using(DayOfYear))
See
http://sqldf.googlecode.com
On Sat, Jul 26, 2008 at 5:26 PM, [EMAIL PROTECTED] wrote:
I have two vectos (list) that represent a years of
Here is a third solution.
A[B$DayOfYear, x] - A[B$DayOfYear, x] - B$x
Its assumes B's days are a subset of A's but if that's not the case then
you would need to intersect them first: ?intersect
On Sat, Jul 26, 2008 at 5:26 PM, [EMAIL PROTECTED] wrote:
I have two vectos (list) that represent a
Sorry, the last one should be:
ix - match(B$DayOfYear, A$DayOfYear)
A[ix, x] - A[ix, x] - B$x
Again we are assuming B's days are a subset of A's.
On Sat, Jul 26, 2008 at 6:08 PM, Gabor Grothendieck
[EMAIL PROTECTED] wrote:
Here is a third solution.
A[B$DayOfYear, x] - A[B$DayOfYear, x] - B$x
I think the
merge()
function should be adequate for this task. Here is an example.
A - data.frame(day=1:5, x=runif(5))
B - data.frame(day=3:7, x=runif(5))
A
day x
1 1 0.9764534
2 2 0.9693998
3 3 0.1324933
4 4 0.8311153
5 5 0.3264465
B - data.frame(day=3:8,
Dear all,
how can I, with R, transform a presence-only table (with the names of
the species (1st column), the lat information of the sites (2nd column)
and the lon information of the sites (3rd column)) into a
presence-absence (0/1) matrix of species occurrences across sites, as
given in the
on 07/22/2008 11:24 AM Christian Hof wrote:
Dear all,
how can I, with R, transform a presence-only table (with the names of
the species (1st column), the lat information of the sites (2nd column)
and the lon information of the sites (3rd column)) into a
presence-absence (0/1) matrix of
frames into one. In SQL, we can just simply use the join comment.
What should we do in R? Is there any package that allows us to run SQL
statements with R data?
Thank you in advance for your help,
Willa
This message contains confidential information and is in...{{dropped:8
should we do in R? Is there any package that allows us to run SQL
statements with R data?
Thank you in advance for your help,
Willa
This message contains confidential information and is in...{{dropped:8}}
__
R-help@r-project.org mailing list
https
On Sat, Jul 12, 2008 at 7:44 AM, sj [EMAIL PROTECTED] wrote:
Hello,
I am trying to do some fairly straightforward data summarization, i.e., the
kind you would do with a pivot table in excel or by using SQL queires. I
have a moderately sized data set of ~70,000 records and I am trying to
See sqldf home page:
http://sqldf.googlecode.com
e.g.
library(sqldf)
set.seed(1)
pti -rnorm(7,10)
fid - rnorm(7,100)
finc - rnorm(7,1000)
# set is a reserved word in SQL so use sset
sset - data.frame(fid,pti,finc)
system.time(out - sqldf(select fid, sum(pti) from sset group by
fid))
Hello,
I am trying to do some fairly straightforward data summarization, i.e., the
kind you would do with a pivot table in excel or by using SQL queires. I
have a moderately sized data set of ~70,000 records and I am trying to
compute some group averages and sum values within groups. the code
Hello,
I am trying to do some fairly straightforward data summarization, i.e., the
kind you would do with a pivot table in excel or by using SQL queires. I
have a moderately sized data set of ~70,000 records and I am trying to
compute some group averages and sum values within groups. the code
Betreff: [R] data summarization etc...
Hello,
I am trying to do some fairly straightforward data summarization, i.e., the
kind you would do with a pivot table in excel or by using SQL queires. I
have a moderately sized data set of ~70,000 records and I am trying to
compute some group averages
-
-Ursprüngliche Nachricht-
Von: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Im
Auftrag von Daniel Malter
Gesendet: Friday, July 11, 2008 7:53 PM
An: 'sj'; 'r-help'
Betreff: Re: [R] data summarization etc...
The problem is that you do not really have categories. You draw 3 times
7
Can somebody please let me know what is the maximum number of rows and
columns that R can handle in a datafile?
Thanks Regards,
Arghya Ganguli
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the
/3/08, arghya ganguli [EMAIL PROTECTED] wrote:
From: arghya ganguli [EMAIL PROTECTED]
Subject: [R] Data size
To: r-help@r-project.org
Received: Thursday, July 3, 2008, 7:41 AM
Can somebody please let me know what is the maximum number
of rows and
columns that R can handle in a datafile
I'd like to thank those who contacted me with ideas on how to solve
this little problem. I learned something from looking through each
snippet of code, even if it wasn't doing quite what I'd hoped it would
do. Mark Leeds deserves special thanks, for helping me debug my
several attempts to improve
I am looking for a way to generate a data matrix that contains all possible
response patterns for 10 binary items. This should produce a matrix with 10
rows (representing 10 items) and 1024 columns (representing 2^10 possible
response patterns). Does anyone know of code that would produce such
this is probably a cludge, and there may be a neater way to do this,
but... here's one:
a = 0:1
for (i in 1:9){ a= merge(unname(a), 0:1) }
a = t(a)
after the for loop, 'a' will contain a 1024 row by 10 col dataframe.
putting it through a transpose, gives you the 10 rows by 1024 cols
Try this also:
t(expand.grid(rep(list(0:1), 10)))
On Thu, Jun 26, 2008 at 3:18 PM, SARAH A DEPAOLI [EMAIL PROTECTED] wrote:
I am looking for a way to generate a data matrix that contains all possible
response patterns for 10 binary items. This should produce a matrix with 10
rows
mat - outer( 0:9, 0:(1024-1), function(x,y) y %/% (2^x) %% 2 )
On Thu, 26 Jun 2008, Daniel Folkinshteyn wrote:
this is probably a cludge, and there may be a neater way to do this, but...
here's one:
a = 0:1
for (i in 1:9){ a= merge(unname(a), 0:1) }
a = t(a)
after the for loop, 'a'
Hello, everyone.
I'm hoping to prevent myself from doing a lot of pointing and clicking
in Excel. I have a dataframe of bird nest check observations, in which
I know the date of the first check, the date of the second check (both
currently in Julian date format), the status of the nest at the
Is this what you want:
x - read.table(textConnection(Check1 Check2 HatchDate
+ 101 121 110
+ 130 150 140
+ 140 150 160), header=TRUE)
closeAllConnections()
x
Check1 Check2 HatchDate
1101121 110
2130150 140
3140150 160
I'm new to R so please forgive the newbie question; but i can't seem to
find a definitive answer to this.
I am wanting to do a PLS regression on some data. Which takes a formula
of the type
responseACC ~ dataACC
where dataACC is multivariate in nature and responseACC is a single value.
I
Hi all,
I have a data management question. I am using an panel dataset read into
R as a dataframe, call it ex. The variables in ex are: id year x
id: a character string which identifies the unit
year: identifies the time period
x: the variable of interest (which might contain NAs).
Here is
I want to draw a subset of ex by selecting only the A and B units:
ex1 - subset(ex[which(ex$id==A|ex$id==B),])
or a bit simpler:
ex1 - subset(ex, ex$id %in% c('A','B'))
In your expresion you don't need the subset function, as you are already
using indexing to extract the desired subset.
Greetings,
Q #1
--
How does one combine data frames by row ... no cleverness a la
merge(), just add rows.
For example, given A with 20 rows and B with 30 rows, I want C =
combine( A, B) having 50 rows.
Columns having matching names should be filled from both (all)
sources with
Hi Chip,
Try this:
# For Q1
R C1 = rbind(A,B)
or
R C2 = do.call(rbind,list(A,B))
R all.equal(C1,C2) # TRUE
# For Q2
R set.seed(123)
R vx=1:10
R A = matrix(rnorm(500),ncol=10)
R A2=t(sapply(A,rep,10))
R A2[vx,]- A[vx,]
R A2
R dim(A2) # 500 10
R dim(A)# 50 10
HTH,
Jorge
On Fri,
Giovanni Petris GPetris at uark.edu writes:
## Example: Ratings of prime minister (Agresti, Table 12.1, p.494)
rating - matrix(c(794, 86, 150, 570), 2, 2)
dimnames(rating) - list(First = c(approve, disapprove),
+ Second = c(approve, disapprove))
rating
-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Ben Bolker
Sent: Friday, May 02, 2008 7:36 AM
To: [EMAIL PROTECTED]
Subject: Re: [R] Data manipulation for random intercept GLMM
Giovanni Petris GPetris at uark.edu writes:
## Example: Ratings of prime
Dear all,
how can I, with R, transform a presence-absence (0/1) matrix of species
occurrences into a presence-only table (3 columns) with the names of the
species (1st column), the lat information of the sites (2nd column) and
the lon information of the sites (3rd column), as given in the
PM
To: r-help@r-project.org
Subject: [R] data transformation
Dear all,
how can I, with R, transform a presence-absence (0/1) matrix
of species occurrences into a presence-only table (3 columns)
with the names of the species (1st column), the lat
information of the sites (2nd column
Hi Christian,
Here's a way using the reshape package:
dfr
site lat lon spec1 spec2 spec3 spec4
1 site1 10 11 1 0 1 0
2 site2 20 21 1 1 1 0
3 site3 30 31 0 1 1 1
library(reshape)
dfr - melt(dfr[, -1], id=1:2, variable_name='species')
1201 - 1300 of 1414 matches
Mail list logo