Displaying 20 results from an estimated 10000 matches similar to: "reading in only one column from text file"
2011 Jul 14
5
Adding rows based on column value
Dear all,
I have one problem and did not find any solution.(I have also attached the problem in text file because sometimes column spacing is not good in mail)
I have a file(file.txt) attached with this mail.I am reading it using this code to make a data frame (file)-
file=read.table("file.txt",fill=T,colClasses = "character",header=T)
file looks like this-
Chr Pos
2006 Mar 08
0
survival
Dear R-helpers,
We marked 6000 leaves from 5 SPECIES - 10 individuals/species - in two
different TREATMENTs: a control and a dry-plot from which 50% of
incoming precipitation was excluded. We followed those leaves for 42
months and noted the presence and absence at each visit. I then carried
out a Cox Harzard model to see differences in leaf mortality between
parcels and among species over time:
2013 Apr 08
3
Reshaping a table
Hello all,
I have data in the form of a table:
X Y1 Y2
0.1 3 2
0.2 2 1
And I would like to transform in the form:
X Y
0.1 Y1
0.1 Y1
0.1 Y1
0.1 Y2
0.1 Y2
0.2 Y1
0.2 Y1
0.2 Y2
Any ideas how?
Thanks in advance,
IOanna
[[alternative HTML version deleted]]
2013 Jun 18
2
find closest value in a vector based on another vector values
Dear All,
would you please provide your thoughts on the following:
let us say I have:
a <-c(1,5,8,15,32,69)
b <-c(8.5,33)
and I would like to extract from "a" the two values that are closest to the values in "b", where the length of this vectors may change but b will allways be shorter than "a". So at the end based on this example I should have the result
2005 Jun 20
3
How to define S4 methods for '['
Folks:
This is a question about the S4 formal class system.
Suppose I have a class, 'foo', defined by:
setClass('foo',representation(dat='matrix', id='character') )
I wish to define a '[' method for foo that will extract from the 'dat' slot.
I would have thought that the following would work, but it doesn't:
2004 Jul 15
3
color scale to label a plot
Hello R-helpers
I want to put a color scale in a plot:
I've got an xy plot where the values of the response (z=f(x,y)) is symbolically given by colors (like heat or rainbow color scale)
I would like to put such a scale with apprpriates labels in the plot, so as to facilitate the interpretation (like in a finite elements result plot)
How is taht possible?
Thanks
Anne
[[alternative
2013 Sep 02
3
Product of certain rows in a matrix
Hi,
You could try:
A<- matrix(unlist(read.table(text="
1 2 3
4 5 6
7 8 9
9 8 7
6 5 4
3 2 1
",sep="",header=FALSE)),ncol=3,byrow=FALSE,dimnames=NULL)
library(matrixStats)
?res1<-t(sapply(split(as.data.frame(A),as.numeric(gl(nrow(A),2,6))),colProds))
?res1
#? [,1] [,2] [,3]
#1??? 4?? 10?? 18
#2?? 63?? 64?? 63
#3?? 18?? 10??? 4
2006 Apr 06
5
pros and cons of "robust regression"? (i.e. rlm vs lm)
Can anyone comment or point me to a discussion of the
pros and cons of robust regressions, vs. a more
"manual" approach to trimming outliers and/or
"normalizing" data used in regression analysis?
2006 Jun 22
1
High breakdown/efficiency statistics -- was RE: Rosner's test [Broadcast]
What would be nice is to have something like a "robust" task view...
Andy
From: Berton Gunter
>
> Many thanks for this Martin. There now are several packages
> with what appear to be overlapping functions (or at least
> algorithms). Besides those you mentioned, "robust" and
> "roblm" are at least two others. Any recommendations about
> how or
2006 Jan 09
2
warning message from nlme
Hi all,
I tried to do a variance components using nlme, but I got the following
warning mesage
#####################################################
not meaningful for factors in: Ops.factor(y[revOrder], Fitted)
######################################################
Can someone point out what is the meaning of this warning message? I
tried to look at Ops.factor, but I don't
2006 Mar 15
2
generating RANDOM ROWS from matrix
Dear group,
I would like to generate a 1000 random rows from a MATRIX with dimensions
12,000 by 20 (i.e. to generate a 1000 by 20 matrix of random rows)
Does the function sample() work for this???
thank you in advance
[[alternative HTML version deleted]]
2005 Oct 19
3
adding error bars to lattice plots
Dear R-Users,
how to include error bars within lattice?
How should the panel = function(x,y,...){
looks like?
Does panel.arrows works here as well?
I appreciate any help on this.
Regards,
Mario AT
[[alternative HTML version deleted]]
2006 May 16
3
everytime I download a new version of R, need I reinstall all packages?
Can the packages that I've installed in R 2.2.1 be automatically imported to
R 2.3.0?
Otherwise it is a hassle everytime I update a new version of R...
[[alternative HTML version deleted]]
2006 May 16
2
stop current computation does not work?
Press "ESC" is supposed to be able to stop the current computation... but
often times it does not really work... I had to kill the R process to stop
and restart the session...
What is a good way to stop/cancel the current computation?
[[alternative HTML version deleted]]
2004 Jun 22
3
Regression Modeling query
Hi All
I received a raw data set with one record per tennis player (both male and
female) and then i cured it by aggregation i.e by 4 age groups, 2 gender
levels and 6 income levels. Gender and Income are categorical variables.
Please advise me how to use 'R' to model this data set (Actually, i want to
know the right regression technique and steps to do that, including removing
2011 May 12
3
assigning creating missing rows and values
I have a dataset where I have missing times (11:00 and 16:00). I would like
the outputs to include the missing time so that the final time vector looks
like "realt" and has the previous time's value. Ex. If meas at time 15:30 is
0.45, then the meas for time 16:00 will also be 0.45.
meas are the measurements and times are the times at which they were taken.
meas<-runif(18)
2005 Jun 14
2
lattice, panel.grid, and scales=list(tick.number=XXX)
I have a Lattice plot in which I want to adjust the number of tick
marks used, and I want to have the drawn grid reflect that change.
Here is what I'm doing:
bwplot(var1 ~ var2, data=df, scales=list(tick.number=10),
panel=function(...) {
panel.grid(h=0,v=-1,...);
panel.stripplot(col="gray40", pch="|", cex=2, ...);
panel.bwplot(...);
})
2006 Aug 01
2
R Reference Card and other help (especially useful for Newbies)
Hi all:
Newbies (and others!) may find useful the R Reference Card made available by
Tom Short and Rpad at http://www.rpad.org/Rpad/Rpad-refcard.pdf or through
the "Contributed" link on CRAN (where some other reference cards are also
linked). It categorizes and organizes a bunch of R's basic, most used
functions so that they can be easily found. For example, paste() is
2006 Feb 13
2
reshaping data
Hello,
I have data in a frame:
1 2 3 4 5 6 7 8
9 10 11 12 13 14 15 16
I would like them arranged in a single column:
1
2
3
4
.
.
8
9
.
.
16
etc.
I believe this should be possible using reshape, but I can't see how
to do it.
Thanks for sparing time to help a neophyte,
Roger Mason
2005 Jul 27
4
R Reference Card (especially useful for Newbies)
Newbies (and others!) may find useful the R Reference Card made available by
Tom Short and Rpad at http://www.rpad.org/Rpad/Rpad-refcard.pdf or through
the "Contributed" link on CRAN (where some other reference cards are also
linked). It categorizes and organizes a bunch of R's basic, most used
functions so that they can be easily found. For example, paste() is under
the