[R] New package PANICr: Looking for reviewer for vignette

2014-10-22 Thread Stephen Bronder
Hello! I recently finished a package that performs nonstationarity tests for large panels and was wondering if anyone would be willing to read over the vignette I wrote. The package uses the PANIC methodology from Bai and Ng (2004, 2010) and is currently available on github. This is the first

[R] Help with GLM starting values in user defined link function

2014-10-22 Thread Andrew.Hoskins
Hi R-list, I'm trying to fit a binomial GLM with user defined link function (negative exponential), however I seem to be unable to find the correct starting values to initialise such a model. I've tried taking starting values from a logistic and log models fit to the same data and also tried to

[R] how to build a heatmap like this

2014-10-22 Thread escaping
Hi, everyone, I am a new R user, and was required to build several heatmaps as shown in attached file. To reach it, I need to normalize the RPKM data of exon-level expression to generate Z-score using R. The data looks like mpleId geneNa

Re: [R] [Sweave] doesn't accept unicode?

2014-10-22 Thread moonkid
Maybe your answers are solutions, but not in my case. As I indicated with my code-sample I don't have a complete tex-file (with usepackage, document-env, etc). I only generate a piece of a tex file to \input it later in my puplication tex-file. So there is no way to specifiy an encoding with a

[R] Merge of the rows by finding the sum of the rows

2014-10-22 Thread Hafizuddin Arshad
Dear R users, Can someone help me on this? I would like to find the sum of the Rain if the Month appears more than once. For example in row 3 and 4, October appear more than once, so I want to find the sum of the two rows and replace it so that the Month just appear once. It some sort of merge bu

Re: [R] Fwd: as.POSIXlt() Function

2014-10-22 Thread David Winsemius
On Oct 22, 2014, at 7:46 PM, Jeff Newmiller wrote: > Because PST8PDT probably is not a valid TZ on your operating system. Try > "America/LosAngeles" For me (on a Mac) it has an intervening dash: > Sys.timezone(location = TRUE) [1] "America/Los_Angeles" However, on a mac the system returns a d

Re: [R] Fwd: as.POSIXlt() Function

2014-10-22 Thread Jeff Newmiller
Because PST8PDT probably is not a valid TZ on your operating system. Try "America/LosAngeles" --- Jeff NewmillerThe . . Go Live... DCN:Basics: ##.#. ##.#. Live Go...

[R] Add an NA column to a zoo object

2014-10-22 Thread jpm miao
Hi , I have a zoo object with several rows fx, r3m, etc. I would like to create in the zoo object the lag of one column. One thing I can think of is to create the lag first and then merge it into the original zoo object, which is tedious. Can I add an NA column to the zoo object first and then p

Re: [R] Split fixed width data in R

2014-10-22 Thread Zilefac Elvis
Thanks John. AT. On Wednesday, October 22, 2014 5:23 PM, John McKown wrote: On Wed, Oct 22, 2014 at 10:37 AM, Zilefac Elvis wrote: Hi, >I have fixed width data that I would like to split into columns. Here is a >sanpshot of the data (actual data is a list object): >​ >Thanks, >AT. > > ​

Re: [R] assignment 2 part 1,2,3

2014-10-22 Thread Rolf Turner
Fortune nomination! cheers, Rolf On 23/10/14 12:17, David Winsemius wrote: You should read the Posting Guide. It makes very clear that no mind reading services are offered. On Oct 21, 2014, at 9:01 AM, Carlos M Castaneda wrote: I am not taking this course for a grade, just self interest.

Re: [R] Split fixed width data in R

2014-10-22 Thread John McKown
On Wed, Oct 22, 2014 at 10:37 AM, Zilefac Elvis wrote: > Hi, > I have fixed width data that I would like to split into columns. Here is a > sanpshot of the data (actual data is a list object): > ​ > > Thanks, > AT. > > ​I see you already have an answer that you like. I will add that read.fwf mig

Re: [R] assignment 2 part 1,2,3

2014-10-22 Thread David Winsemius
You should read the Posting Guide. It makes very clear that no mind reading services are offered. On Oct 21, 2014, at 9:01 AM, Carlos M Castaneda wrote: > I am not taking this course for a grade, just self interest. I am stock > with making the function. is there any where I can see how is done

Re: [R] Split fixed width data in R

2014-10-22 Thread Zilefac Elvis
Thanks Ellison. Just what I wanted. Cheers. AT. On Wednesday, October 22, 2014 10:03 AM, S Ellison wrote: This seems to do a fair bit of it on your example data; you can pull out the date bits separately using Date functions if you need them decode.lst <- function(x) { data.frame(Date=as

Re: [R] reducing the sampling rate of a .wav file

2014-10-22 Thread Dimitri Liakhovitski
Thank you so much, Uwe! seavewav is from another package :) On Wed, Oct 22, 2014 at 4:03 PM, Uwe Ligges wrote: > > > On 22.10.2014 21:57, Dimitri Liakhovitski wrote: >> >> I've read in a wav file using 'tuneR': >> >> silence<-readWave("silence0.5sec.wav") >> >> I run summary(silence): >> >> Wave

Re: [R] reducing the sampling rate of a .wav file

2014-10-22 Thread Dimitri Liakhovitski
Thank you so much, Uwe! seavewav is from another package :) On Wed, Oct 22, 2014 at 4:03 PM, Uwe Ligges wrote: > > > On 22.10.2014 21:57, Dimitri Liakhovitski wrote: >> >> I've read in a wav file using 'tuneR': >> >> silence<-readWave("silence0.5sec.wav") >> >> I run summary(silence): >> >> Wave

Re: [R] reducing the sampling rate of a .wav file

2014-10-22 Thread Uwe Ligges
On 22.10.2014 21:57, Dimitri Liakhovitski wrote: I've read in a wav file using 'tuneR': silence<-readWave("silence0.5sec.wav") I run summary(silence): Wave Object Number of Samples: 22051 Duration (seconds): 0.5 Samplingrate (Hertz): 44100 Channels (Mono/Stereo): Mono PCM (integer

[R] reducing the sampling rate of a .wav file

2014-10-22 Thread Dimitri Liakhovitski
I've read in a wav file using 'tuneR': silence<-readWave("silence0.5sec.wav") I run summary(silence): Wave Object Number of Samples: 22051 Duration (seconds): 0.5 Samplingrate (Hertz): 44100 Channels (Mono/Stereo): Mono PCM (integer format): TRUE Bit (8/16/24/32/64):16 Summary

Re: [R] How to clear R memory in a for loop

2014-10-22 Thread Dimitri Liakhovitski
Thank you very much for looking into it, gentlemen! On Tue, Oct 21, 2014 at 2:29 PM, Uwe Ligges wrote: > > > On 21.10.2014 19:00, William Dunlap wrote: >> >> A few minutes with valgrind showed that output_pos was never >> initialized, so the output array was not getting filled correctly. >> The f

Re: [R] import and export data for RMark package

2014-10-22 Thread Jeff Laake - NOAA Federal
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 wrote: > Dear R users,I wondering how I can import and extract the dat

Re: [R] sort a data.frame in a different way

2014-10-22 Thread Sven E. Templer
seems like a transpose, so use ?t t(your.data.frame) On 22 October 2014 11:34, Matthias Weber wrote: > Hello together, > > i have a little problem. Maybe anyone can help me. > > I have a data. frame which look like this one: > 1000 1001 10021003 > 15 6 12

Re: [R] creating individual records from a frequency distribution

2014-10-22 Thread Sven E. Templer
With melt and rep you are close. If you combine them it works: library(reshape) # your data: df1 <- data.frame(area=c(1,2),group1=c(2,3),group2=c(1,5),group3=c(4,0)) df2<-data.frame(person_id=seq(1:15),area=c(rep(1,7),rep(2,8)),group_num=c(1,1,2,3,3,3,3,1,1,1,2,2,2,2,2)) # first melt d <- melt(df1

[R] how to import and export data in RMark package

2014-10-22 Thread Kristi Glover
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 . I tried following script to import and export. Importing was OK but did not work for exporting. Would you give any suggestions? install.packages("RMark")library(RM

[R] assignment 2 part 1,2,3

2014-10-22 Thread Carlos M Castaneda
I am not taking this course for a grade, just self interest. I am stock with making the function. is there any where I can see how is done. I will not submit the home work. I want to use the homework as a tool to understand.\ the Coding for R. Thanks [[alternative HTML version deleted]]

[R] import and export data for RMark package

2014-10-22 Thread Kristi Glover
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)

[R] import and export data for RMark package

2014-10-22 Thread Kristi Glover
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)

[R] sort a data.frame in a different way

2014-10-22 Thread Matthias Weber
Hello together, i have a little problem. Maybe anyone can help me. I have a data. frame which look like this one: 1000 1001 10021003 15 6 1211 24 3 81 What i need is a data.frame, which looks like this one. The Column na

[R] Fwd: as.POSIXlt() Function

2014-10-22 Thread Vasantha Kumar Kesavan
Hi, I am a new R user and also not sure about the below concern is really a bug, My concern are listed below, Look at the below example, when Sys.Date () is called within the as.POSIXlt () function. Why it is displaying only the date value and the timezone is selected to UTC even though the TZ v

Re: [R] Split fixed width data in R

2014-10-22 Thread S Ellison
> -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On > Behalf Of Clint Bowman > > ?read.fortran Also read.fwf if it's in a file. S *** This email and any attachments are con

Re: [R] Split fixed width data in R

2014-10-22 Thread S Ellison
This seems to do a fair bit of it on your example data; you can pull out the date bits separately using Date functions if you need them decode.lst <- function(x) { data.frame(Date=as.Date(substr(x,1,8), format="%Y%m%d"), Site=substr(x, 9,12),

Re: [R] Split fixed width data in R

2014-10-22 Thread Clint Bowman
?read.fortran Clint BowmanINTERNET: cl...@ecy.wa.gov Air Quality Modeler INTERNET: cl...@math.utah.edu Department of Ecology VOICE: (360) 407-6815 PO Box 47600FAX:(360) 407-7534 Olympia, WA 98504-7600

[R] creating individual records from a frequency distribution

2014-10-22 Thread Gavin Rudge
I've got data frame containing a simple frequency distribution of numbers of people in three age groups by area. df1<-data.frame(area=c(1,2),group1=c(2,3),group2=c(1,5),group3=c(4,0)) df1 I want to get a data frame with one record per person (in my case 15 of them) which would look like this, w

[R] Split fixed width data in R

2014-10-22 Thread Zilefac Elvis
Hi, I have fixed width data that I would like to split into columns. Here is a sanpshot of the data (actual data is a list object): lst1Sub<- "20131124GGG1 23.00" "20131125GGG1 15.00" "20131128GGG1 0.00" "201312 1GGG1 0.00" "201312 4GGG1 0.00" "201312 7GGG1 10.00" "20131210GGG1 0.00" "20

Re: [R] glmer with multiple random slopes

2014-10-22 Thread Ben Bolker
David Kikuchi gmail.com> writes: > > Hi all, > > I'm modeling the probability that a subject attacks or rejects a prey > item based on its proportion of yellow coloration and size. There are > two populations of prey, one defended and the other undefended, so > subjects should reject one typ

Re: [R] add text to the first line of an output file

2014-10-22 Thread Henrik Bengtsson
Alright, if it is the case that the "output file" already exists, then yes Sven's suggestion is more or less the only solution. Henrik On Oct 22, 2014 2:08 AM, "Sven E. Templer" wrote: > He wants to prepend, not append. > > On 22 October 2014 11:04, Henrik Bengtsson wrote: > > You can! Open a f

Re: [R] format negative numbers

2014-10-22 Thread PIKAL Petr
Thanks to all It seems that negative format - is very rare so there is no interest in providing some function for changing such numbers to "correct" ones. My function seems to be similar to solution of others so I stay with it for the time being. Cheers Petr > -Original Message-

Re: [R] add text to the first line of an output file

2014-10-22 Thread Sven E. Templer
He wants to prepend, not append. On 22 October 2014 11:04, Henrik Bengtsson wrote: > You can! Open a file connection and write to that. Whatever write commands > you use will append to the output. Don't forget to close the connection at > the end. See ?file > > Henrik > > On Oct 22, 2014 12:33 AM

Re: [R] add text to the first line of an output file

2014-10-22 Thread Henrik Bengtsson
You can! Open a file connection and write to that. Whatever write commands you use will append to the output. Don't forget to close the connection at the end. See ?file Henrik On Oct 22, 2014 12:33 AM, "Sven E. Templer" wrote: > Hi. > > You can't. > > But using a second file where you first writ

Re: [R] add text to the first line of an output file

2014-10-22 Thread Rui Barradas
Hello, Just use ?cat and ?write.table with append = TRUE. Something like the following. txt <- "ampl.tab 2 1" dat <- read.table(text = " A B 2 3 4 6 2 0 ", header = TRUE) tmp <- "tmp.txt" cat(txt, "\n", file = tmp) " Don't forget the newline "\n" write.table(dat, file = tmp, append = T

[R] running the aggregate claims distribution using the package "actuar"

2014-10-22 Thread Charles Thuo
# i run the following after fitting claims data into the negative binomial as the frequency distribution and the lognormal for the severity distribution using the package "fitdistrplus". require(actuar) fx<- discretize(plnorm(x,11.69,0.79331),method="unbiased",step=500,from=0, to=qln

Re: [R] add text to the first line of an output file

2014-10-22 Thread Sven E. Templer
Hi. You can't. But using a second file where you first write your header and then append the original file is a solution. ?cat and ?write.table with a focus on the 'append' argument should help. you can then use ?unlink to delete the original file and ?file.rename to rename the second, if desired