Thanks for the advice,
df<-read.table(infile, sep="," skip = 1, header=TRUE)
is indeed much cleaner from the outset (and was my usual way to it).
I was unaware that
readLines(infile, n=1)
could get me the first line without reading the whole file again.
But I do need to get my head around th
Dear users,
I am importing a csv file whose first row is a single value that I need to
capture in a variable.
infile<-file.choose()
in<-read.csv( infile, header=FALSE)
single.value<-as.character(in[1,1]) # fine
Now I need to take rows 3 and on as the data
df<-in[3:dim(in)[1],]
But row 2
Dear R-users,
I am trying to get the plyr syntax right, without much success.
Given:
d<- data.frame(cbind(x=1,y=seq(20100801,20100830,1)))
names(d)<-c("first", "daterep")
d2<-d
# I can convert the daterep column in place the classic way:
d$daterep<-as.Date(strptime(d$daterep, format="%Y%m%d"))
Dear R-users,
I am unsuccessful in trying to add an horizontal line to all graphs in the
example below:
library(lattice)
val<-runif(15)
x<-rep(seq(1:5),3)
type<-c(rep("a",5), rep("b",5), rep("c",5))
xyplot(val ~ x | type, panel.abline(h=.6))
Any hints are appreciated.
Best regards,
---Jean
Hi,
Is it just me or it appears the "temperature" and "probability" should be
reversed?
Anyhow it should help you to assign your model to a variable (as Joshua did
with his own suggestion)
yourmodel <-lm(x[,2] ~ x[,1] + I(x[,1]^2)) # again, taking literally the way
you formulated it...
Many thanks to all, the first 3 solutions worked nicely but I did not get
around to tweaking properly the others. It's really nice to get thing going
in a "one liner" or about... Again greatly appreciated. Cheers!
--
View this message in context:
http://r.789695.n4.nabble.com/Simple-but-elusive-e
Dear R-users,
This should be simple but still eludes me:
Given the following
tmp<-as.data.frame(matrix(c(44, 10, "abc", 1, 44, 10, "def", 1, 44, 12,
"abc", 2), 3, 4, byrow=T))
I want to expand the data to the following form:
V1 V2 V3 V4
1 44 10 abc 1
2 44 10 def 1
3 44 12 abc 1
4 44 12 a
7 matches
Mail list logo