[R] Help a newbie
baptiste auguie
baptiste.auguie at googlemail.com
Fri Sep 18 11:26:15 CEST 2009
I don't understand your question.
Where does your data come from in the first place? Is it stored in a
file, or is it a result of a previous operation in R, or is it
something you need to copy and paste in your script, or ...?
the textConnection() construct is often used to make for
self-contained examples on this list, but the real-world data are
often stored in separate text files (which can be read in read.table()
by specifying the filename).
HTH,
baptiste
2009/9/18 ogbos okike <ogbos.okike at gmail.com>:
> Hello,
> To me as a beginner, every problem looks big. Below is what I was asked to
> do as part of a code that will solve my problem. I have used read.table to
> read my data into R and assigned the column names with colnames(dat)<- ... .
> But to go from txt<-" to the last " at the bottom of the table below is what
> I am unable to do. Could anybody please tell me how to type or arrive at
> txt<-"
> y m d count
> ..................
> ..................
> "
> in R.
> Thank you for your attention
> Ogbos
> .........................................................................................................................................................................................................................................................
>
> Here is a more extensive example that shows also how to get date or counts
> associated to pits/peaks:
>
> txt <- "
> y m d count
> 93 02 07 3974.6
> 93 02 08 3976.7
> 93 02 09 3955.2
> 93 02 10 3955.0
> 93 02 11 3971.8
> 93 02 12 3972.8
> 93 02 13 3961.0
> 93 02 14 3972.8
> 93 02 15 4008.0
> 93 02 16 4004.2
> 93 02 17 3981.2
> 93 02 18 3996.8
> 93 02 19 4028.2
> 93 02 20 4029.5
> 93 02 21 3953.4
> 93 02 22 3857.3
> 93 02 23 3848.3
> 93 02 24 3869.8
> 93 02 25 3898.1
> 93 02 26 3920.5
> 93 02 27 3936.7
> 93 02 28 3931.9
> "
> con <- textConnection(txt)
> dat <- read.table(con, header = TRUE)
> close(con)
> dat$date <- as.Date(paste(dat$y, dat$m, dat$d), format = "%y %m %d")
>
> library(pastecs)
> tp <- turnpoints(dat$count)
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
More information about the R-help
mailing list