Dear R users,I wondering how I can import and extract the data of .txt format to the format that is compatible with RMark package for further analysis. I tried following example but did not work. Would you give any suggestions? install.packages("RMark")library(RMark) #Import table (inp format) in R and Exportexample.1 <- convert.inp("http://www.montana.edu/rotella/502/deer.inp")head(example.1) # wanted to add the variable "states" (locations)example.1$state<-ifelse(row.names(example.1) > 76, c("B"), c("A")) # to save it in txtwrite.table(example.1, "testing.txt", row.names=F, sep = "\t") # import the txt file data<-import.chdata("testing.txt", field.names=c("ch","freq","states"), header=FALSE)data<-data[-1,]mstrata.processed=process.data(data, model="Multistrata")# it did not work # to export the data into inp formatexport.chdata(mstrata.processed, filename="testing") Thanks Kristi [[alternative HTML version deleted]]
Dear R users,I wondering how I can import and extract the data of .txt format to the format that is compatible with RMark package for further analysis. I tried following example but did not work. Would you give any suggestions? install.packages("RMark")library(RMark) #Import table (inp format) in R and Exportexample.1 <- convert.inp("http://www.montana.edu/rotella/502/deer.inp")head(example.1) # wanted to add the variable "states" (locations)example.1$state<-ifelse(row.names(example.1) > 76, c("B"), c("A")) # to save it in txtwrite.table(example.1, "testing.txt", row.names=F, sep = "\t") # import the txt file data<-import.chdata("testing.txt", field.names=c("ch","freq","states"), header=FALSE)data<-data[-1,]mstrata.processed=process.data(data, model="Multistrata")# it did not work # to export the data into inp formatexport.chdata(mstrata.processed, filename="testing") Thanks Kristi [[alternative HTML version deleted]]
Jeff Laake - NOAA Federal
2014-Oct-22 19:33 UTC
[R] import and export data for RMark package
Kristi- Any questions related to RMark should be sent to the forum on RMark at phidot.org. If you provide me with a snippet of your data I will try to help you. regards --jeff On Wed, Oct 22, 2014 at 5:55 AM, Kristi Glover <kristi.glover at hotmail.com> wrote:> Dear R users,I wondering how I can import and extract the data of .txt > format to the format that is compatible with RMark package for further > analysis. I tried following example but did not work. Would you give any > suggestions? > > install.packages("RMark")library(RMark) > #Import table (inp format) in R and Exportexample.1 <- convert.inp(" > http://www.montana.edu/rotella/502/deer.inp")head(example.1) > # wanted to add the variable "states" > (locations)example.1$state<-ifelse(row.names(example.1) > 76, c("B"), > c("A")) > # to save it in txtwrite.table(example.1, "testing.txt", row.names=F, sep > = "\t") > # import the txt file data<-import.chdata("testing.txt", > field.names=c("ch","freq","states"), > header=FALSE)data<-data[-1,]mstrata.processed=process.data(data, > model="Multistrata")# it did not work > # to export the data into inp formatexport.chdata(mstrata.processed, > filename="testing") > > Thanks Kristi > > [[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. >[[alternative HTML version deleted]]