[R] How to convert a graph into an image in R

2012-09-19 Thread punitha
In R, I want to convert the plotted graph into an image and save it, so that i can make use of it later. - Thank you, with regards, Punitha -- View this message in context: http://r.789695.n4.nabble.com/How-to-convert-a-graph-into-an-image-in-R-tp4643584.html Sent from the R help mailing

Re: [R] How to convert a graph into an image in R

2012-09-19 Thread David Winsemius
On Sep 18, 2012, at 10:57 PM, punitha wrote: In R, I want to convert the plotted graph into an image and save it, so that i can make use of it later. Generally the GUI's handle this with 'save as...' functions. but if you are in a console session then consult: ?Devices ?pdf ?png ?jpeg --

Re: [R] scraping with session cookies

2012-09-19 Thread Duncan Temple Lang
Hi ? The key is that you want to use the same curl handle for both the postForm() and for getting the data document. site = u = http://www.wateroffice.ec.gc.ca/graph/graph_e.html?mode=textstn=05ND012prm1=3syr=2012smo=09sday=15eyr=2012emo=09eday=18; library(RCurl) curl = getCurlHandle(cookiefile

[R] invalid labels; length 2 should be 1 or 0

2012-09-19 Thread ya
Dear list, I am trying to impute the two level data, I have a question about a warning. Could you give me some suggestions please? Thank you very much. Here is my code and output of mice package: ini - mice(try, maxit=0) pred=ini$pred pred FAC1_1 FAC2_1 FAC3_1 FAC4_1 FAC5_1

Re: [R] help with calculation from dataframe with multiple entries per sample

2012-09-19 Thread R. Michael Weylandt
On Wednesday, September 19, 2012, Jul_biologyGrad wrote: Thanks everyone for the help! I pulled together a bunch of your suggestions to get the result that I needed. I'm posting my final code below. Probably not the most efficient way of doing things but gets the job done in a way that a

[R] Discrepancies in weighted nonlinear least squares

2012-09-19 Thread Andrej-Nikolai Spiess
Dear all, I encounter some discrepancies when comparing the deviance of a weighted and unweigthed model with the AIC values. A general example (from 'nls'): DNase1 - subset(DNase, Run == 1) fm1DNase1 - nls(density ~ SSlogis(log(conc), Asym, xmid, scal), DNase1) This is the

Re: [R] factor expansion

2012-09-19 Thread PIKAL Petr
Hi I did not see any answer yet but can you explain what you mean by factor expansion? Something like expand.grid? Petr -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- project.org] On Behalf Of Jose Bustos Melo Sent: Wednesday, September 12, 2012

Re: [R] Why x[1] is not getting substituted?

2012-09-19 Thread PIKAL Petr
Hi because you need to evaluate it. print(paste(Trial and ,eval(x[1]), sheet)) Regards Petr -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- project.org] On Behalf Of Sri krishna Devarayalu Balanagu Sent: Tuesday, September 18, 2012 11:41 AM To:

Re: [R] [newbie] aggregating table() results and simplifying code with loop

2012-09-19 Thread John Kane
-Original Message- From: ridav...@gmail.com Sent: Wed, 19 Sep 2012 00:42:50 +0200 To: ruipbarra...@sapo.pt Subject: Re: [R] [newbie] aggregating table() results and simplifying code with loop Hi dear R-helpers, I really appreciate your coding the answers to (my) questions. I

Re: [R] Why x[1] is not getting substituted?

2012-09-19 Thread Jim Lemon
Sri krishna Devarayalu Balanagu wrote: Suppose I want the output as Trial and a sheet without quotes x=c(a, b, c) print(Trial and x[1] sheet) Getting Trial and x[1] sheet Can anyone help? And for your sins in not reading the documentation: cat(paste(rev(c(sheet,x[1],and,Trial))),\n)

[R] problem in displaying image in browser using Rook

2012-09-19 Thread punitha
hi, I wanted to convert a graph into image and display it in browser, i got the image in the given folder and everything is coming out well but the image is not being displayed, even the error or warning is not being given so i dont know what exactly i have made mistake in the code, please can

[R] Importing a CSV file

2012-09-19 Thread Anthi Oikonomou
Hi, I am trying to import csv file in R console I have saved my data in a file on the desktop named R and here is my problematic script load(C:\\Users\\Anthi\\Desktop\\R\\A.csv) Error: bad restore file magic number (file may be corrupted) -- no data loaded In addition: Warning message: file

[R] Setting library path (again)

2012-09-19 Thread Kyran Graham
Hi, Sorry for posting a question that has been asked before but I couldn't quite find the right answer in previous help topics. I am trying to set my library path to a user-specified library (C:/Users/K/Documents/Work/RLib). I have used .libPaths(C:/Users/K/Documents/Work/RLib) but when I check

Re: [R] Importing a CSV file

2012-09-19 Thread Sarah Goslee
Hi, load() is for R's binary data files. You need to use read.csv(), as you tried, but probably with the complete path. A - read.csv(C:\\Users\\Anthi\\Desktop\\R\\A.csv, header=TRUE) Sarah On Wed, Sep 19, 2012 at 4:54 AM, Anthi Oikonomou anthi.oi...@gmail.com wrote: Hi, I am trying to import

Re: [R] Importing a CSV file

2012-09-19 Thread Rui Barradas
Hello, Try ?read.csv. dat - read.csv(C:\\Users\\Anthi\\Desktop\\R\\A.csv) Note that unlike what happens with load() you'll need an explicit assignment. Hope this helps, Rui Barradas Em 19-09-2012 09:54, Anthi Oikonomou escreveu: Hi, I am trying to import csv file in R console I have

Re: [R] Importing a CSV file

2012-09-19 Thread Frans Marcelissen
Hi, Should'nt it be A - read.csv(C:Users\\Anthi\\Desktop\\R\\A.csv, header=TRUE) (c:\\ becomes c:\ In general I think it is better to use / and //) Frans -Oorspronkelijk bericht- Van: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] Namens Sarah Goslee Verzonden:

Re: [R] Setting library path (again)

2012-09-19 Thread Duncan Murdoch
On 19/09/2012 6:30 AM, Kyran Graham wrote: Hi, Sorry for posting a question that has been asked before but I couldn't quite find the right answer in previous help topics. I am trying to set my library path to a user-specified library (C:/Users/K/Documents/Work/RLib). I have used

Re: [R] Importing a CSV file

2012-09-19 Thread Sarah Goslee
On Wed, Sep 19, 2012 at 9:53 AM, Frans Marcelissen frans.marcelis...@digipsy.nl wrote: Hi, Should'nt it be A - read.csv(C:Users\\Anthi\\Desktop\\R\\A.csv, header=TRUE) (c:\\ becomes c:\ In general I think it is better to use / and //) Frans No idea; I was copying the original poster's

Re: [R] Importing a CSV file

2012-09-19 Thread Rui Barradas
Em 19-09-2012 15:01, Sarah Goslee escreveu: On Wed, Sep 19, 2012 at 9:53 AM, Frans Marcelissen frans.marcelis...@digipsy.nl wrote: Hi, Should'nt it be A - read.csv(C:Users\\Anthi\\Desktop\\R\\A.csv, header=TRUE) (c:\\ becomes c:\ In general I think it is better to use / and //) Frans No

Re: [R] Importing a CSV file

2012-09-19 Thread Marc Schwartz
On Sep 19, 2012, at 9:26 AM, Rui Barradas ruipbarra...@sapo.pt wrote: Em 19-09-2012 15:01, Sarah Goslee escreveu: On Wed, Sep 19, 2012 at 9:53 AM, Frans Marcelissen frans.marcelis...@digipsy.nl wrote: Hi, Should'nt it be A - read.csv(C:Users\\Anthi\\Desktop\\R\\A.csv, header=TRUE)

Re: [R] Why x[1] is not getting substituted?

2012-09-19 Thread David Winsemius
On Sep 19, 2012, at 6:26 AM, PIKAL Petr wrote: Hi because you need to evaluate it. print(paste(Trial and ,eval(x[1]), sheet)) The eval is superfluous, since paste() already evaluates its unquoted arguments. print(paste(Trial and, x[1], sheet)) [1] Trial and a sheet -- David.

[R] effective way to return only the first argument of which()

2012-09-19 Thread Mike Spam
Hi, I was looking for a function like which() but only returns the first argument. Compare: x - c(1,2,3,4,5,6) y - 4 which(xy) returns: 5,6 which(xy)[1] returns: 5 which(xy)[1] is exactly what i need. I did use this but the dataset is too big (~18 mio. Points). That's why i need a more

Re: [R] scraping with session cookies

2012-09-19 Thread CPV
Thank you for your help Duncan, I have been trying what you suggested however I am getting an error when trying to create the function fun- createFunction(forms[[1]]) it says Error in isHidden I hasDefault : operations are possible only for numeric, logical or complex types On Wed, Sep 19, 2012

Re: [R] effective way to return only the first argument of which()

2012-09-19 Thread R. Michael Weylandt
On Wed, Sep 19, 2012 at 3:20 PM, Mike Spam ichmags...@googlemail.com wrote: Hi, I was looking for a function like which() but only returns the first argument. Compare: x - c(1,2,3,4,5,6) y - 4 which(xy) returns: 5,6 which(xy)[1] returns: 5 which(xy)[1] is exactly what i need. I

Re: [R] effective way to return only the first argument of which()

2012-09-19 Thread Jeff Newmiller
?which.max --- Jeff NewmillerThe . . Go Live... DCN:jdnew...@dcn.davis.ca.usBasics: ##.#. ##.#. Live Go... Live: OO#.. Dead:

Re: [R] effective way to return only the first argument of which()

2012-09-19 Thread Mike Spam
Hi, Thanks Michael, but i think this is even slower. x -sample(2000) which(x 5)[1] which.max(x 5) system.time(for(i in 1:100) which.max(x 5)) User System verstrichen 60.84 13.70 86.33 system.time(for(i in 1:100) which(x 5)[1]) User System

Re: [R] effective way to return only the first argument of which()

2012-09-19 Thread William Dunlap
The original method is faster than which.max for longish numeric vectors (in R-2.15.1), but you should check time and memory usage on your own machine: x - runif(18e6) system.time(for(i in 1:100)which(x0.99)[1]) user system elapsed 11.641.05 12.70 system.time(for(i in

[R] R package for dashboard

2012-09-19 Thread XINLI LI
What package can be used to produce dashboard in R? Thanks and Regards, Xin __ R-help@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

[R] drop zero slots from table?

2012-09-19 Thread Sam Steingold
I find myself doing --8---cut here---start-8--- tab - table(...) tab - tab[tab 0] tab - sort(tab,decreasing=TRUE) --8---cut here---end---8--- all the time. I am wondering if the drop 0 (and maybe even sort?) can be effected

Re: [R] scraping with session cookies

2012-09-19 Thread Duncan Temple Lang
You don't need to use the getHTMLFormDescription() and createFunction(). Instead, you can use the postForm() call. However, getHTMLFormDescription(), etc. is more general. But you need the very latest version of the package to deal with degenerate forms that have no inputs (other than button

[R] Help reproducing a contour plot

2012-09-19 Thread Tinus Sonnekus
Hi All, I am trying to reproduce this using R instead. [image: Full-size image (38 K)] I tried using the following code *SChla - read.csv(SM_Chla_data.csv)* *Atlantis - SChla[16:66,]* *head(Atlantis)* * * Seamount Station Depth Pico Nano Micro Total_Chdbar Latitude Longitud 16

Re: [R] effective way to return only the first argument of which()

2012-09-19 Thread Milan Bouchet-Valat
Le mercredi 19 septembre 2012 à 15:23 +, William Dunlap a écrit : The original method is faster than which.max for longish numeric vectors (in R-2.15.1), but you should check time and memory usage on your own machine: x - runif(18e6) system.time(for(i in 1:100)which(x0.99)[1])

Re: [R] R package for dashboard

2012-09-19 Thread Bhupendrasinh Thakre
Depends on your requirement . Who is going to use it. Do you want something like running in browser or something like excel or somewhat different like Tcl tk. Best Regards, Bhupendrasinh Thakre Sent from my iPhone On Sep 19, 2012, at 10:48 AM, XINLI LI lihaw...@gmail.com wrote: What package

Re: [R] drop zero slots from table?

2012-09-19 Thread Sam Steingold
Function --8---cut here---start-8--- sorted.table - function (vec) { tab - table(vec) tab - tab[tab 0] sort(tab, decreasing=TRUE) } --8---cut here---end---8--- does what I want but it prints vec instead of the name of

Re: [R] drop zero slots from table?

2012-09-19 Thread William Dunlap
Here is one way: sorted.table - function(x, name = if (is.list(x))names(x) else deparse(substitute(x))[1]) { +tab - table(x) +names(dimnames(tab)) - name +tab - tab[tab 0] +sort(tab, decreasing=TRUE) + } digits - factor(trunc(100*log2(1:20)%%.1), levels=0:9)

Re: [R] Why x[1] is not getting substituted?

2012-09-19 Thread Greg Snow
I nominate Jim's answer below for the fortunes package. On Wed, Sep 19, 2012 at 3:50 AM, Jim Lemon j...@bitwrit.com.au wrote: Sri krishna Devarayalu Balanagu wrote: Suppose I want the output as Trial and a sheet without quotes x=c(a, b, c) print(Trial and x[1] sheet) Getting Trial

[R] export date field using sqlSave

2012-09-19 Thread Al Kirschbaum
Hello- I'm receiving an error when I try to export a dataframe into Access 2010 containing a date field using sqlSave. The error I'm receiving is: [RODBC] Failed exec in Update 22018 39 [Microsoft][ODBC Microsoft Access Driver]Invalid character value for cast specification I can export all

[R] write.table: strange output has been produced

2012-09-19 Thread Igor
Good afternoon all - While making a steady progress in learning R after Matlab I encountered a problem which seems to require some extra help to move over. Basically I want to merge a data from biological statistical dataset with annotation data extracted from another dataset using an 'id'

[R] Warning Message: In if (deparse(params[[nm]][[3]]) != 1)

2012-09-19 Thread obuyacharles
I am using the gnls procedure in nlme package to fit a nonlinear model as: nl.fit-gnls(Y ~ b0*exp(b1/X), data = data1, params=list( b0~p1+I(p1^2)+p2+I(p2^2)+p3+I(p3^2)+p5+p6 b1~p8+p2+I(p2^2)+p3+p9+p10+p11),

Re: [R] R package for dashboard

2012-09-19 Thread Bhupendrasinh Thakre
One of the package which I know of is rgooglevis. However there should be some more in the same line. Copying it to the list so someone else also chime in for answer. Best Regards, Bhupendrasinh Thakre Sent from my iPhone On Sep 19, 2012, at 11:52 AM, XINLI LI lihaw...@gmail.com wrote:

Re: [R] scraping with session cookies

2012-09-19 Thread CPV
Thanks again, I run the script with the postForm(site, disclaimer_action=I Agree) and it does not seem to do anything, the webpage is still the disclaimer page thus I am getting the error below Error in function (classes, fdef, mtable) : unable to find an inherited method for function

Re: [R] Warning Message: In if (deparse(params[[nm]][[3]]) != 1)

2012-09-19 Thread Jeff Newmiller
Usually the source of such errors is the data you provide to the function. Since you have not followed the posting guide and provided a reproducible example, we are under a significant handicap in troubleshooting your problem.

Re: [R] write.table: strange output has been produced

2012-09-19 Thread David Winsemius
On Sep 19, 2012, at 9:12 AM, Igor wrote: Good afternoon all - While making a steady progress in learning R after Matlab I encountered a problem which seems to require some extra help to move over. Basically I want to merge a data from biological statistical dataset with annotation data

Re: [R] write.table: strange output has been produced

2012-09-19 Thread jim holtman
It would also be helpful if you could provide the output of 'str' for all the objects that you are using. e.g., str(statdata)str(extra) Also in creating your data.frame, use stringsAsFactors = FALSE: extra = data.frame(kogdefline=rep(NA,n) , kogClass = rep(NA,n) , kogGroup =

[R] Multi lines in R plot

2012-09-19 Thread Gary Dong
Dear R users, I'm plotting 5 loess smooth lines in one paragraph. Since the publisher does not print colorful pictures, I differentiate them by using different line types. I'm wondering if there are other options to make the graph more readable. It is really difficult for readers to tell the

Re: [R] drop zero slots from table?

2012-09-19 Thread Sam Steingold
cool, thanks! Still, I wonder if there is a way to pass all args as is from a function downward (like in a lisp macro); something like sorted.table - function (...) { tab - table(...); ... } * William Dunlap jqha...@gvopb.pbz [2012-09-19 16:26:08 +]: Here is one way: sorted.table -

[R] where are these NAs coming from?

2012-09-19 Thread Sam Steingold
I see this: --8---cut here---start-8--- length(which(is.na(z$language))) [1] 0 locals - z[z$country == mycountry,] length(which(is.na(locals$language))) [1] 229 --8---cut here---end---8--- where are those locals without the

Re: [R] where are these NAs coming from?

2012-09-19 Thread Sarah Goslee
Well, you have no reproducible example, but I suspect either of these will fix it: locals - z[z$country == mycountry !is.na(z$country),] locals - subset(z, country == mycountry) Sarah On Wed, Sep 19, 2012 at 1:50 PM, Sam Steingold s...@gnu.org wrote: I see this: --8---cut

Re: [R] where are these NAs coming from?

2012-09-19 Thread jim holtman
At least provide a reproducible example by creating the problem with a subset of 'z' and 'mycountry' Could something like this be happening? x - data.frame(country = 1:5, language = 1:5) mycountry - NA z - x[x$country == mycountry,] z country language NANA NA NA.1 NA

Re: [R] effective way to return only the first argument of which()

2012-09-19 Thread Bert Gunter
Well, following up on this observation, which can be put under the heading of Sometimes vectorization can be much slower than explicit loops , I offer the following: firsti -function(x,k) { i - 1 while(x[i]=k){i - i+1} i } system.time(for(i in 1:100)which(x.99)[1]) user system

Re: [R] where are these NAs coming from?

2012-09-19 Thread Sam Steingold
Thanks, Sarah, your answer is, indeed, revealing: --8---cut here---start-8--- z - data.frame(a=c(1,2,3),b=c(5,6,NA)) z a b 1 1 5 2 2 6 3 3 NA z[z$b==6,] a b 2 2 6 NA NA NA --8---cut here---end---8--- why do I

Re: [R] where are these NAs coming from?

2012-09-19 Thread Duncan Murdoch
On 19/09/2012 1:50 PM, Sam Steingold wrote: I see this: --8---cut here---start-8--- length(which(is.na(z$language))) [1] 0 locals - z[z$country == mycountry,] length(which(is.na(locals$language))) [1] 229 --8---cut

Re: [R] where are these NAs coming from?

2012-09-19 Thread Sarah Goslee
R doesn't know whether the missing (NA) value is 6 or not, so by default it returns it so the user can make up her own mind. If you're using square brackets for subsetting, you need to explicitly handle NA cases. If using subset(), the default behavior is to remove them. ?[ explains this. Sarah

Re: [R] drop zero slots from table?

2012-09-19 Thread William Dunlap
Why don't you try that and tell us if it works? Bill Dunlap Spotfire, TIBCO Software wdunlap tibco.com -Original Message- From: Sam Steingold [mailto:sam.steing...@gmail.com] On Behalf Of Sam Steingold Sent: Wednesday, September 19, 2012 10:48 AM To: r-help@r-project.org; William

Re: [R] where are these NAs coming from?

2012-09-19 Thread Jeff Newmiller
I don't. You are getting to be a regular around here, so you should know better by now. Please stop posting non-reproducible sample code. --- Jeff NewmillerThe . . Go Live...

Re: [R] drop zero slots from table?

2012-09-19 Thread Sam Steingold
* William Dunlap jqha...@gvopb.pbz [2012-09-19 18:20:50 +]: Why don't you try that and tell us if it works? Because in my wildest dreams it did not occur to me that this could be valid code in any programming language. It appears to be valid R, which seems to be out-perling Perl at every

Re: [R] where are these NAs coming from?

2012-09-19 Thread Sam Steingold
* jim holtman wubyg...@tznvy.pbz [2012-09-19 13:58:08 -0400]: At least provide a reproducible example by creating the problem with a subset of 'z' and 'mycountry' if I knew how to reproduce the problem, I would have known what was going on. Could something like this be happening?

Re: [R] effective way to return only the first argument of which()

2012-09-19 Thread Berend Hasselman
On 19-09-2012, at 20:02, Bert Gunter wrote: Well, following up on this observation, which can be put under the heading of Sometimes vectorization can be much slower than explicit loops , I offer the following: firsti -function(x,k) { i - 1 while(x[i]=k){i - i+1} i }

Re: [R] effective way to return only the first argument of which()

2012-09-19 Thread Bert Gunter
Excellent point! Thanks. -- Bert On Wed, Sep 19, 2012 at 12:00 PM, Berend Hasselman b...@xs4all.nl wrote: On 19-09-2012, at 20:02, Bert Gunter wrote: Well, following up on this observation, which can be put under the heading of Sometimes vectorization can be much slower than explicit loops

Re: [R] where are these NAs coming from?

2012-09-19 Thread Jeff Newmiller
if I knew how to reproduce the problem, I would have known what was going on. This is a worthless excuse. You are the one with the example in front of you. I grant that paring it down to email size can take some time, but every second of that time is worthwhile, and at least half the battle is

Re: [R] Warning Message: In if (deparse(params[[nm]][[3]]) != 1)

2012-09-19 Thread obuyacharles
I am not sure if it is possible to provide a data set sufficient to fit this model and reproduce the error. However, I noticed that the warnings no longer show up when the number of predictors for b0 and b1 in b0~ and b1 ~ is small (3 to 5). Could this be an effect too many

Re: [R] R package for dashboard

2012-09-19 Thread arun
HI, May be brew package helps you. You can also check this link (http://learnr.wordpress.com/2009/04/09/ggplot2-sales-dashboard/). A.K. - Original Message - From: XINLI LI lihaw...@gmail.com To: r-help r-help@r-project.org Cc: Sent: Wednesday, September 19, 2012 11:48 AM Subject:

[R] FASTA annot issue

2012-09-19 Thread Mary Halpin
I am trying to pull a subset form a large group of FASTA sequences. I need to pull them based on the annot and write.fasta them. I have my subset annot titles in a .csv. What is the way to go about this? I tried pulling the sequences from a .csv but then MEGA 5 was not happy when i tried to put

[R] Wilcoxon Test and Mean Ratios

2012-09-19 Thread Mohamed Radhouane Aniba
Hello All, I am writing to ask your opinion on how to interpret this case. I have two vectors a and b that I am trying to compare. The wilcoxon test is giving me a pvalue of 5.139217e-303 of a over b with the alternative greater. Now if I make a summary on each of them I have the following

[R] issue accessing help files

2012-09-19 Thread Basil Iannone
Dear R-help community, I am unable to access help files when using the typical ?function.of.interest command. For example, if I type ?anova, Internet Explorer opens, but I am never connected to the usual page describing the nuances of the anova function. This is a new problem (just started

[R] histogram plot spacing problem

2012-09-19 Thread firespot
Hi, So I plot a histogram using the built-in hist function: hist(rnorm(100), ...). Now the y-axis starts at its lower end at 0 (very sensible, of course) and that's where the baseline for the rectangles of the histogram is drawn, but the x-axis itself is offset a bit to the lower. I.e. there

Re: [R] write.table: strange output has been produced

2012-09-19 Thread Igor Chernukhin
Hi David - Thank you for your reply. You are probably right. The last 'normal' line doesn't have a double quote closed. There is the complete line below: -8

Re: [R] write.table: strange output has been produced

2012-09-19 Thread Igor Chernukhin
Hi Jim - Thank you for your reply. -8 str(annot) 'data.frame': 6895 obs. of 4 variables: $ id : int 231803 231804 231805 231810 231811 231816 231818 177697 223131 231823 ... $ kogdefline : Factor w/ 1898 levels 17

Re: [R] Help reproducing a contour plot

2012-09-19 Thread Rui Barradas
Hello, I remember this dataset from not a long time ago. Please use dput() to post your data and do not use formatting to post code. As for the question, though your example is not reproducible (it doesn't run) see

[R] correlating matrices

2012-09-19 Thread frauke
Hi, thank you for taking the time and reading my question. My question is twofold: 1. I have several matrices with variables and one matrix with water levels. I want to predict the water level with the data in the other matrices. Basically, * mod-lm(matrix1 ~ matrix2+matrix3)* ( What looks like

[R] Merging two or more frequency tables

2012-09-19 Thread mcelis
I am new to R and am looking to merge two or more frequency tables into one. I have searched around but have been unable to find exactly what I need. I have two frequency tables obtained from two sample texts t0-table(strsplit(tolower(It was the age of wisdom it was the age of foolishness it was

Re: [R] histogram plot spacing problem

2012-09-19 Thread Rui Barradas
Hello, Try the following. x - rnorm(100) hist(x, xaxt = n) axis(1, at = pretty(x), pos = 0) Hope this helps, Rui Barradas Em 19-09-2012 18:51, firespot escreveu: Hi, So I plot a histogram using the built-in hist function: hist(rnorm(100), ...). Now the y-axis starts at its lower end at 0

Re: [R] issue accessing help files

2012-09-19 Thread Rui Barradas
Hello, I had a problem seeing the help pages with R 2.14.(0 or 1? I don't remember) on Windows 7. Then I realized that after a command like print, Rgui would first display an error message saying that the temp directory used by help didn't exist. The solution I've found was to manually create

[R] [R-pkgs] New Package 'JMbayes' for the Joint Modeling of Longitudinal and Survival Data under a Bayesian approach

2012-09-19 Thread D. Rizopoulos
Dear R-users, I would like to announce the release of the new package JMbayes available from CRAN (http://CRAN.R-project.org/package=JMbayes). This package fits shared parameter models for the joint modeling of normal longitudinal responses and event times under a Bayesian approach using

[R] Data Frame (Very Simple Problem)

2012-09-19 Thread Bhupendrasinh Thakre
Hi List Members, This is a very stupid problem but I am not able to know what the solution can be. I am trying to run a query like below *Program Flow :* 1. a - data.frame(table( cut( Sys.time() + seq(0,82800,3600), 60 mins) )) # It generates the 60 minute intervals. Thanks David 2. b -

Re: [R] write.table: strange output has been produced

2012-09-19 Thread David Winsemius
On Sep 19, 2012, at 12:20 PM, Igor Chernukhin wrote: Hi David - Thank you for your reply. You are probably right. The last 'normal' line doesn't have a double quote closed. There is the complete line below: -8

Re: [R] Help reproducing a contour plot

2012-09-19 Thread David Winsemius
On Sep 19, 2012, at 8:55 AM, Tinus Sonnekus wrote: Hi All, I am trying to reproduce this using R instead. [image: Full-size image (38 K)] I tried using the following code *SChla - read.csv(SM_Chla_data.csv)* *Atlantis - SChla[16:66,]* *head(Atlantis)* * * Seamount Station

Re: [R] Data Frame (Very Simple Problem)

2012-09-19 Thread Rui Barradas
Hello, Your code is reproducible and completely explains the issue, thanks. First I had the impression of a well organized question. Then I've read point 4. 4. The sequence 1:1 starts and ends at 1. You don't need b[1:1, 1:1], b[1, 1] will do. Then you assign a different value to 'b'. This

Re: [R] write.table: strange output has been produced

2012-09-19 Thread Igor
Thank you David - you put me into right direction. Back to normal, problem sorted. I've missed a single quote in 'annot' data when I imported it from file using read.table function with the default 'quote' argument. quote=\ did the trick. Many thanks -Igor On Wed, 2012-09-19 at 14:55 -0700,

[R] [R-pkgs] lqmm package 1.02

2012-09-19 Thread Geraci, Marco
Dear R users lqmm version 1.02 is now on CRAN. lqmm provides commands for estimation of linear quantile regression models with random effects. Commands for independent and count data are also available. A few bugs have been fixed since lqmm 1.0. Updates of this package are (usually) made

Re: [R] Merging two or more frequency tables

2012-09-19 Thread arun
HI, Try this: dt0-data.frame(t0)  dt1-data.frame(t1) res1-merge(dt0,dt1,by=Var1) res2-aggregate(Freq.x+Freq.y~Var1,data=res1,sum) colnames(res2)[2]-Freq res3-rbind( dt0[!dt0$Var1%in%res2$Var1,],dt1[!dt1$Var1%in%res2$Var1,] ,res2) row.names(res3)-1:nrow(res3)  xtabs(Freq~Var1,data=res3) #Var1   #  

Re: [R] Merging two or more frequency tables

2012-09-19 Thread Rui Barradas
Hello, Try the following. fun - function(x, ...){ z - Reduce(paste, list(x, ...)) tsum - table(strsplit(tolower(z), \\W)) tsum } x - It was the age of wisdom it was the age of foolishness it was the epoch of belief y - it was the epoch of incredulity it was the season of Light it

Re: [R] Data Frame (Very Simple Problem)

2012-09-19 Thread arun
Hi, Try this: a - data.frame(table( cut( Sys.time() + seq(0,82800,3600), 60 mins) b - data.frame(a$Var1)  str(b) #'data.frame':    24 obs. of  1 variable: # $ a.Var1: Factor w/ 24 levels 2012-09-19 18:03:00,..: 1 2 3 4 5 6 7 8 9 1 b1-within(b,{a.Var1-as.POSIXct(a.Var1,format=%Y-%m-%d %H:%M:%S)})

Re: [R] correlating matrices

2012-09-19 Thread Rui Barradas
Hello, Inline. Em 19-09-2012 19:56, frauke escreveu: Hi, thank you for taking the time and reading my question. My question is twofold: 1. I have several matrices with variables and one matrix with water levels. I want to predict the water level with the data in the other matrices.

Re: [R] Lowest AIC after stepAIC can be lowered by manual reduction of variables (Florian Moser)

2012-09-19 Thread Claas Damken
A few general comments about stepwiseAIC and a suggestion of how to select models a) Apart form the problem, that stepwise selection is not a garanty to get the best model, you need to have a lot of data to avoid overfitting if your model includes 7 parameter plus interactions ( 10

Re: [R] Merging two or more frequency tables

2012-09-19 Thread mcelis
Both solutions work great. Thank you for your help. -- View this message in context: http://r.789695.n4.nabble.com/Merging-two-or-more-frequency-tables-tp4643663p4643692.html Sent from the R help mailing list archive at Nabble.com. __

Re: [R] Merging two or more frequency tables

2012-09-19 Thread arun
HI, Inspired from Rui's function: Slightly modified:  fun1-function(x,...){  z-paste(unlist(list(x,...)),collapse= )  tsum-table(strsplit(tolower(z),\\W))  tsum}  fun1(x,y)   # age  belief    darkness   epoch foolishness incredulity     # 2   1   1   2

Re: [R] Wilcoxon Test and Mean Ratios

2012-09-19 Thread Thomas Lumley
On Thu, Sep 20, 2012 at 5:46 AM, Mohamed Radhouane Aniba arad...@gmail.com wrote: Hello All, I am writing to ask your opinion on how to interpret this case. I have two vectors a and b that I am trying to compare. The wilcoxon test is giving me a pvalue of 5.139217e-303 of a over b with the

Re: [R] Wilcoxon Test and Mean Ratios

2012-09-19 Thread Mohamed Radhouane Aniba
Thank you Thomas, So you think a t-test is more adequate to use in this case ? Rad On Sep 19, 2012, at 8:43 PM, Thomas Lumley tlum...@uw.edu wrote: On Thu, Sep 20, 2012 at 5:46 AM, Mohamed Radhouane Aniba arad...@gmail.com wrote: Hello All, I am writing to ask your opinion on how to

[R] how can I give same name to column and row?

2012-09-19 Thread Kristi Glover
Hi R User, I calculated a correlation matrix and I was trying to give a same name for rows and columns (heading) in the correlation matrix. But, I was not able to do so. Would you mind let me know how I can assign the same name for the heading of row and columns in the matrix? I appreciate

Re: [R] how can I give same name to column and row?

2012-09-19 Thread Pascal Oettli
Hello, ?colnames Regards, Pascal Le 20/09/2012 11:48, Kristi Glover a écrit : Hi R User, I calculated a correlation matrix and I was trying to give a same name for rows and columns (heading) in the correlation matrix. But, I was not able to do so. Would you mind let me know how I can

Re: [R] how can I give same name to column and row?

2012-09-19 Thread David L Carlson
It does that automatically. Just assign the names you want to the data.frame before you compute the correlation matrix: x - data.frame(matrix(rnorm(100), ncol=5)) colnames(x) - c(A, B, C, D, E) y - cor(x) y A B C D E A 1.

Re: [R] Importing a CSV file

2012-09-19 Thread Heramb Gadgil
Hi All, I have used windows R. We can also write like this: A - read.csv(C:/Users/Anthi/Desktop/R/A.csv,header=TRUE) On Wed, Sep 19, 2012 at 8:09 PM, Marc Schwartz marc_schwa...@me.com wrote: On Sep 19, 2012, at 9:26 AM, Rui Barradas ruipbarra...@sapo.pt wrote: Em 19-09-2012 15:01,

Re: [R] scraping with session cookies

2012-09-19 Thread Heramb Gadgil
Try this, library(RCurl) library(XML) site- http://www.wateroffice.ec.gc.ca/graph/graph_e.html?mode=textstn=05ND012prm1=3syr=2012smo=09sday=15eyr=2012emo=09eday=18 URL-getURL(site) Text=htmlParse(URL,asText=T) This will give you all the web dat in an HTML-Text format. You can use getNodeSet