[R] DOUBT

2023-03-21 Thread Nandini raj
Respected sir/madam can you please suggest what is an unexpected symbol in the below code for running a multinomial logistic regression model <- multinom(adoption ~ age + education + HH size + landholding + Farmincome + nonfarmincome + creditaccesibility + LHI, data=newdata)

Re: [R] C stack usage 7970372 is too close to the limit

2020-08-10 Thread Raj kapoor
Hi John, Only the particular users getting error john. Please help me On Mon, 10 Aug 2020, 11:43 pm Raj kapoor, wrote: > Hi John, > > I have 10 user in the instance, 9 user is working and access the R studio > app, but while access the 10th user it's getting stack usage

Re: [R] C stack usage 7970372 is too close to the limit

2020-08-10 Thread Raj kapoor
Hi John, I have 10 user in the instance, 9 user is working and access the R studio app, but while access the 10th user it's getting stack usage limit issues, then we create the new users its working fine. On Mon, 10 Aug 2020, 10:21 pm John Harrold, wrote: > Hello Raj, > > I've gotten

[R] C stack usage 7970372 is too close to the limit

2020-08-10 Thread Raj kapoor
Hi Team, I have one production instance in aws, in CentoOs linux environment, i have 5 user to access the instance for using RStudio, In case R-studio working 4 users running good, while we access 5th users its getting error, First issue : C stack usage 7970372 is too close to the limit Second

[R] (no subject)

2017-03-05 Thread Nikhil Raj
hello Team R, i have been using R for statistical analysis of phylogeny and i have installed the required packages phangorn and phytools but whenever i give the command "pml.fit" the program stops and it appears thatb r for windows GUI has stopped etc.. previously i thought it was a fault in my

[R] regarding a problem in R

2017-03-05 Thread Nikhil Raj
hello Team R, i have been using R for statistical analysis of phylogeny and i have installed the required packages phangorn and phytools but whenever i give the command "pml.fit" the program stops and it appears thatb r for windows GUI has stopped etc.. previously i thought it was a fault in my

[R] help

2017-03-05 Thread Nikhil Raj
hello Team R, i have been using R for statistical analysis of phylogeny and i have installed the required packages phangorn and phytools but whenever i give the command "pml.fit" the program stops and it appears thatb r for windows GUI has stopped etc.. previously i thought it was a fault in my

[R] How to take a multidimensional data set to higher dimensions using R?

2016-04-24 Thread Devesh Raj Singh
Hi, I have a multidimensional data-set( multiple 'x' variables with a target variable). I want to take it to a higher dimensional space so that I can apply classification technique with ease . Is there a package in R which would allow me to take these data points from lower dimensional space to

[R] Replace a column value on condition

2015-03-23 Thread Kuma Raj
I want to replace column c3 with values from column c2 whenever values of column Id are 2. In stata I could use replace c3 = c2 if id ==2. How could I do that in R? Thanks Sample data found below: dput(df4) structure(list(c2 = c(42L, 42L, 47L, 47L, 55L, 55L, 36L, 36L, 61L, 61L), c3 = c(68L,

[R] Aggegate minutes data to hourly data

2015-03-11 Thread Kuma Raj
I have a measurement that was taken in 15 minutes or more and want to aggregate it by hour. How could I do that? Sample data is found below date_time concentration 26/11/2013 15:46 529.25 26/11/2013 16:03 1596 26/11/2013 16:23 1027.111 26/11/2013 16:39 1001.9 26/11/2013 16:54 -80.25 26/11/2013

[R] rename columns with pattern

2015-01-12 Thread Kuma Raj
I want to rename columns 1 to 6 in the sample data set as bp_1 to bp_6. How could I do that in R? Thanks dput(dff) structure(list(one = c(1.00027378507871, 0.982313483915127, 1.1531279945243, 1.07400410677618, 1.22710472279261, 1.19762271047046, 1.10904859685147, 1.32060232717317), two =

[R] Create previous dates from date with consideration of leap year

2014-12-11 Thread Kuma Raj
Dear R Community, I wish to create 5 preceding dates from the date variable by ID. How could I create such dates? The code should consider leap year. Thanks Sample data follows: structure(list(id = 1:12, date = structure(c(9L, 6L, 11L, 8L, 7L, 5L, 4L, 3L, 12L, 1L, 10L, 2L), .Label =

[R] How to update R without losing packages

2014-10-31 Thread Kuma Raj
A solution on the link below provides the steps of updating R without losing packages in Unix. http://zvfak.blogspot.se/2012/06/updating-r-but-keeping-your-installed.html How could I do that on windows 7 platform? Thanks __ R-help@r-project.org

[R] How can I merge data with differing length?

2014-10-30 Thread Kuma Raj
How can I merge data frame df and tem shown below by filling the head of tem with missing values? a- rnorm(1825, 20) b- rnorm(1825, 30) date-seq(as.Date(2000/1/1), by = day, length.out = 1825) df-data.frame(date,a,b) tem- rpois(1095, lambda=21) Thanks

[R] How to sum some columns based on their names

2014-10-13 Thread Kuma Raj
I want to sum columns based on their names. As an exampel how could I sum columns which contain 6574, 7584 and 85 as column names? In addition, how could I sum those which contain 6574, 7584 and 85 in ther names and have a prefix f. My data contains several variables with I want to sum columns

[R] Generate sequence of date based on a group ID

2014-10-08 Thread Kuma Raj
I want to generate a sequence of date based on a group id(similar IDs should have same date). The id variable contains unequal observations and the length of the data set also varies. How could I create a sequence that starts on specific date (say January 1, 2000 onwards) and continues until the

[R] How to combine character month and year columns into one column

2014-09-23 Thread Kuma Raj
Dear R users, I have a data with month and year columns which are both characters and wanted to create a new column like Jan-1999 with the following code. The result is all NA for the month part. What is wrong with the and what is the right way to combine the two? ddf$MonthDay -

Re: [R] How to combine character month and year columns into one column

2014-09-23 Thread Kuma Raj
if you could suggest a working solution Thanks On 23 September 2014 18:03, Marc Schwartz marc_schwa...@me.com wrote: On Sep 23, 2014, at 10:41 AM, Kuma Raj pollar...@gmail.com wrote: Dear R users, I have a data with month and year columns which are both characters and wanted to create a new

[R] How to identify outliers with values five times 99th percentile

2014-09-09 Thread Kuma Raj
I have a data frame with some extreme values which I wish to identify and repeat an analysis without these extreme values. How could I identify several columns with values which are 5 times higher than the 99th percentile? Sample data is pasted below. dput(df) structure(list(ad1 = c(98, 6.9,

[R] Obtain coefficients of several nlme objects

2014-09-05 Thread Kuma Raj
I have several lme objects like the ones shown below and I wish to combine the coefficients and confidence intervals of fixed effects of several models. Is there a function that could do that job? m1 - lme(mark1 ~ pm10 + temp + + age + gender + bmi + statin + smoke + dow + season

[R] Subset a column with specific characters

2014-09-04 Thread Kuma Raj
This post has NOT been accepted by the mailing list yet. I would like to subset a column based on the contents of a column with specific character. In the sample data I wish to do the following: First keep the data based on column prog if prog contains ca, and secondly to drop if race contains ic

[R] Loop through columns of outcomes

2013-11-12 Thread Kuma Raj
I have asked this question on SO, but it attracted no response, thus I am cross- posting it here with the hope that someone would help. I want to estimate the effect of pm10 and o3 on three outcome(death, cvd and resp). What I want to do is run one model for each of the main predictors (pm10

Re: [R] Loop through columns of outcomes

2013-11-12 Thread Kuma Raj
') + Lag(%s,0:6), o, v) gam(as.formula(f),family=quasipoisson,na.action=na.omit,data=df) })}) m1 - unlist(m1, recursive = FALSE) m1 Hope this helps, Rui Barradas Em 12-11-2013 09:53, Kuma Raj escreveu: I have asked this question on SO, but it attracted no response, thus I am

Re: [R] Loop through columns of outcomes

2013-11-12 Thread Kuma Raj
, `[[`, 'p.table') Hope this helps, Rui Barradas Em 12-11-2013 13:28, Kuma Raj escreveu: Thanks for the script which works perfectly. I am interested to do model checking and also interested to extract the coefficients for linear and spline terms. For model checkup I could run this script which

[R] Remove a column of a matrix with unnamed column header

2013-11-08 Thread Kuma Raj
I have a matrix names test which I want to convert to a data frame. When I use a command test2-as.data.frame(test) it is executed without a problem. But when I want to browse the content I receive an error message Error in data.frame(outcome = c(cardva, respir, cereb, neoplasm, : duplicate

Re: [R] Remove a column of a matrix with unnamed column header

2013-11-08 Thread Kuma Raj
Hasselman b...@xs4all.nl wrote: On 08-11-2013, at 10:40, Kuma Raj pollar...@gmail.com wrote: I have a matrix names test which I want to convert to a data frame. When I use a command test2-as.data.frame(test) it is executed without a problem. But when I want to browse the content I

[R] Subject: Regress multiple independent variables on multiple dependent variables

2013-11-04 Thread Kumar Raj
I want to estimate the effect of several independent variables on several dependent variables. In the example below I wanted to estimate the effect of three independent variables on ozone and temperature. My aim is to create a list of dependent and independent variables and automate the process

Re: [R] Logistic Regression - Variable Selection Methods With Prediction

2011-10-26 Thread RAJ
Can I atleast get help with what pacakge to use for logistic regression with all possible models and do prediction. I know i can use regsubsets but i am not sure if it has any prediction functions to go with it. Thanks On Oct 25, 6:54 pm, RAJ dheerajathr...@gmail.com wrote: Hello, I am pretty

[R] Logistic Regression - Variable Selection Methods With Prediction

2011-10-25 Thread RAJ
Hello, I am pretty new to R, I have always used SAS and SAS products. My target variable is binary ('Y' and 'N') and i have about 14 predictor variables. My goal is to compare different variable selection methods like Forward, Backward, All possible subsests. I am using misclassification rate to

Re: [R] Contingency table in R

2011-03-02 Thread Antony Raj
Hi Laura and R users, I would like to know whether we can do siginificance test between Column Yes and Column No. Any one tried? I have seen it in Tabulaiton software packages from our vendors and in SPSS Custom Table. Thanks, On Wed, Mar 2, 2011 at 7:43 PM, Laura Clasemann

Re: [R] sapply, lattice functions

2010-03-20 Thread Sundar Dorai-Raj
You're right. It's necessary for xyplot though to prevent grouping. On Mar 20, 2010 10:43 AM, Dieter Menne dieter.me...@menne-biomed.de wrote: Sundar Dorai-Raj-2 wrote: Or perhaps more clearly, histogram(~a1 + b1 + c1, data = aa, o... Why outer=TRUE? Looks same for me without: Dieter

Re: [R] sapply, lattice functions

2010-03-19 Thread Sundar Dorai-Raj
Or perhaps more clearly, histogram(~a1 + b1 + c1, data = aa, outer = TRUE) --sundar On Fri, Mar 19, 2010 at 3:50 PM, Gabor Grothendieck ggrothendi...@gmail.com wrote: Try this: histogram(~ values | ind, stack(aa)) On Fri, Mar 19, 2010 at 5:44 PM, Santosh santosh2...@gmail.com wrote:

Re: [R] Source code for the t-distribution

2010-03-09 Thread Sundar Dorai-Raj
Here it is. https://svn.r-project.org/R/trunk/src/nmath/pt.c --sundar On Tue, Mar 9, 2010 at 4:24 AM, Ravi Kulkarni ravi.k...@gmail.com wrote: I have tried looking for the source code for the pt() function in https://svn.r-project.org/R/trunk/src/library/stats/ and am unable to find

Re: [R] capturing errors in Sweave

2010-03-02 Thread Sundar Dorai-Raj
Thanks, Berwin. That works just great! --sundar On Tue, Mar 2, 2010 at 12:57 AM, Berwin A Turlach ber...@maths.uwa.edu.auwrote: G'day Sundar, On Mon, 1 Mar 2010 23:46:55 -0800 Sundar Dorai-Raj sdorai...@gmail.com wrote: Thanks for the input, but I don't want try in the Sweave output. I

Re: [R] capturing errors in Sweave

2010-03-02 Thread Sundar Dorai-Raj
What I ended up using was: cat(unclass(tmp)) --sundar On Tue, Mar 2, 2010 at 8:58 AM, Berwin A Turlach ber...@maths.uwa.edu.auwrote: G'day Sundar, On Tue, 2 Mar 2010 01:03:54 -0800 Sundar Dorai-Raj sdorai...@gmail.com wrote: Thanks, Berwin. That works just great! You are welcome. I

[R] capturing errors in Sweave

2010-03-01 Thread Sundar Dorai-Raj
Hi, I'm writing a manual using Sweave and I want to be able to print errors from bad code. Here's an example: Function-4a= MySqrt - function(x) { if (missing(x)) { stop('x' is missing with no default) } if (!is.numeric(x)) { stop('x' should only be numeric) } if (x 0) {

Re: [R] capturing errors in Sweave

2010-03-01 Thread Sundar Dorai-Raj
Thanks for the input, but I don't want try in the Sweave output. I want the output to look just like it does in the console, as if an uncaptured error really did occur. --sundar On Mon, Mar 1, 2010 at 11:42 PM, Sharpie ch...@sharpsteen.net wrote: Sundar Dorai-Raj-2 wrote: Hi, I'm

Re: [R] How do I juxtapose two lattice graphs with common X axes such that the X axes line up?

2010-01-20 Thread Sundar Dorai-Raj
Try googling latticeExtra x.same for some examples. Here's one: http://www.mail-archive.com/r-help@r-project.org/msg39048.html On Wed, Jan 20, 2010 at 9:44 AM, George Chen glc...@stanford.edu wrote: Hello, I would like to juxtapose two lattice graphs with common X axes such that the X axes

Re: [R] Dynamic arguments in rbind function

2010-01-04 Thread Sundar Dorai-Raj
Use a list instead of assign then do.call(rbind, thelist). import.files - c(a.txt, b.txt, c.txt, d.txt, e.txt) imp - vector(list, length(import.files)) for (i in 1:length(import.files)) { imp[[i]] - read.delim(import.files[i], sep = , header = TRUE) } combined - do.call(rbind, imp) HTH,

Re: [R] makefile for sweave

2009-11-26 Thread Sundar Dorai-Raj
Is texi2dvi in your PATH? What happens if you open a CMD window and type texi2dvi at the prompt? --sundar On Thu, Nov 26, 2009 at 6:14 AM, Wolfgang Raffelsberger wr...@igbmc.fr wrote: Dear all, I can't get texi2dvi working right. Basically I'd like to convert a .lex to .pdf without having to

Re: [R] Why F value and Pr are not show in summary() of an aov() result?

2009-11-22 Thread Sundar Dorai-Raj
It's hard to read your code, so I won't comment on your specific example. So when all else fails read the documentation for ?summary.aov: They have columns ‘Df’, ‘Sum Sq’, ‘Mean Sq’, as well as ‘F value’ and ‘Pr(F)’ if there are non-zero residual degrees of freedom. So if you do

Re: [R] denoting max value in ylim

2009-11-20 Thread Sundar Dorai-Raj
ylim = c(0, max(log10(D10$Part.P))) Make sure you remove any 0s or NAs before computing the max though. --sundar On Fri, Nov 20, 2009 at 6:12 AM, helene frigstad helenefrigs...@hotmail.com wrote: Hi, is there any way to set the ylim range from zero to whatever is the max value in that

Re: [R] lapply() not converting columns to factors (no error message)

2009-11-16 Thread Sundar Dorai-Raj
Works for me: x - read.csv(url(http://dc170.4shared.com/download/153147281/a5c78386/Testvcomp10.csv?tsid=20091116-075223-c3093ab0;)) names(x) x[2:13] - lapply(x[2:13], factor) levels(x$P1L55) [1] 0 1 is.factor(x$P1L96) [1] TRUE sessionInfo() R version 2.10.0 (2009-10-26)

Re: [R] lapply() not converting columns to factors (no error message)

2009-11-16 Thread Sundar Dorai-Raj
, because the same thing's worked for me too before but won't do now. I tried to reinstall it (base), but R says its there already which I expected it to be anyway. I don't quite know where the issue is. Very odd. --On 16 November 2009 04:59 -0800 Sundar Dorai-Raj sdorai...@gmail.com wrote

Re: [R] Trellis settings get lost when printing to pdf

2009-11-13 Thread Sundar Dorai-Raj
Did you make the changes before or after starting the device: library(lattice) ## before doesn't change the settings on the device: trellis.par.set(plot.symbol = list(col = red)) trellis.device(pdf, file = tmp.pdf) xyplot(1 ~ 1) dev.off() ## after does trellis.device(pdf, file = tmp.pdf)

Re: [R] tapply function

2009-11-03 Thread Sundar Dorai-Raj
you must have missing values in data. Try tapply(data, group, mean, na.rm = TRUE) If that's not the case, read the bottom of this email about the posting guide. HTH, --sundar On Tue, Nov 3, 2009 at 5:28 AM, FMH kagba2...@yahoo.com wrote: Hi, I tried to use tapply function to find the mean

Re: [R] Issue with %in% - not matching identical rows in data frames

2009-11-03 Thread Sundar Dorai-Raj
?%in% says x and table must be vectors. You supplied data.frames. So %in% is coercing your today.sequence to a vector using as.character(today.sequence) Perhaps you should paste the columns together first: x - do.call(paste, c(sequence, sep = ::)) table - do.call(paste, c(today.sequence, sep =

Re: [R] How can I run a function to a piece of text?

2009-10-16 Thread Sundar Dorai-Raj
Based solely on what you told us, this can be done using eval(parse(text=...)) cmd - sprintf(mean(%s), script) eval(parse(text = cmd)) However, with more context, there may be a better solution. See, for example, install.packages(fortunes) library(fortunes) fortune(parse()) HTH, --sundar On

Re: [R] Error in family$family : $ operator is invalid for atomic vectors

2009-10-11 Thread Sundar Dorai-Raj
Check to see if you have an old workspace being loaded. You might have an object called 'family' which you might need to remove. --sundar On Oct 11, 2009 12:15 PM, romunov romu...@gmail.com wrote: Thank you Jorge and Barry for your input. I've fiddled around a bit and as a result, am even more

Re: [R] How to speed up R with version 2.9.2?

2009-10-02 Thread Sundar Dorai-Raj
Another possibility is a very large .RData file in the directory where you're starting R. You can try Rgui --no-restore (I don't have windows, so I'm not sure if this an option with RGui, though I know it is with R.) --sundar On Fri, Oct 2, 2009 at 8:50 AM, Gabor Grothendieck

Re: [R] Skipping missing files when importing data

2009-09-20 Thread Sundar Dorai-Raj
Try ?file.exists. if (file.exists(fxxx)) { read.table(fxxx) } else { cat(\, fxxx, \ is missing\n, sep = ) } HTH, --sundar On Sun, Sep 20, 2009 at 9:28 PM, jiangrm jian...@gmail.com wrote: Trying to import a bunch of data files named like f001, f002, f999. Some of the files may be

Re: [R] xyplot: Can I identify groups but not use them for regression?

2009-09-18 Thread Sundar Dorai-Raj
I think this ought to work for you: library(lattice) set.seed(42) d - data.frame(year = c(rep(2007,12), rep(2008,12)), treatment = rep(LETTERS[1:3], each = 4, times = 2)) d$cover - rnorm(nrow(d)) d$variable - rnorm(nrow(d)) xyplot(variable ~ cover | year, d, panel =

Re: [R] Lattice graph tweaking

2009-08-25 Thread Sundar Dorai-Raj
A reproducible example would be nice. Try grid = FALSE for the first question, though I'm unaware which lattice plot you are using where the default is TRUE. So I can't guarantee that will even work. For your second question, add par.settings = list(strip.background = list(col = white)) to

Re: [R] Help with nls and error messages singular gradient

2009-08-25 Thread Sundar Dorai-Raj
Hi, Michael, I think the SPSS answer is wrong. Your starting values are way off. Look at this plot for verification: con - textConnection(time bod 11 0.47 22 0.74 33 1.17 44 1.42 55 1.60 67 1.84 79 2.19 8 11 2.17) mydata - read.table(con, header = TRUE) close(con)

Re: [R] Help with nls and error messages singular gradient

2009-08-25 Thread Sundar Dorai-Raj
Another alternative is to use SSlogis which is very similar to the model you're fitting except with one additional parameter: Asym - 3 xmid - 0 scal - 10 model - nls(bod ~ SSlogis(time, Asym, xmid, scal), data = mydata) summary(model) plot(bod ~ time, mydata) newdata - data.frame(time = seq(1,

[R] Reg: Creation of own Package and Permanent Dataset in R

2009-07-28 Thread RAJ
Hi, This is Raj from ClinAsia and we have a small query with respect to R Statistical Package. Our Query: Actually while opening R console and R commander we see some packages like car and datasets. In these packages we have default datasets. For example: Women and Prestige so on. Now we

Re: [R] how to check if ... is empty

2009-07-16 Thread Sundar Dorai-Raj
Try dots - list(...) if (length(dots) == 0) { ## do something } On Thu, Jul 16, 2009 at 6:46 AM, Thomas Roth (geb. Kaliwe)hamstersqu...@web.de wrote: Hi, I was wondering what would be the best way to check if the three dots argument contains any arguments (i.e. does ... contain any

Re: [R] Lattice group colors?

2009-06-22 Thread Sundar Dorai-Raj
Look at show.settings() and str(trellis.par.get()). This will show you what the default settings are. The group colors are set by the superpose.* elements (e.g. superpose.line is for group lines). To set them, I usually create a list and pass it to par.settings. For example, my.theme -

Re: [R] reading in multiple files

2009-06-09 Thread Sundar Dorai-Raj
You could try: do.call(rbind, lapply(list.files(path/to/files, full = TRUE), read.csv)) And add more arguments to lapply if the files are not csv, have no header, etc. --sundar On Tue, Jun 9, 2009 at 11:18 AM, Erin Hodgesserinm.hodg...@gmail.com wrote: Dear R People: I have about 6000 files

Re: [R] find a sequence of characters in a vector

2009-06-05 Thread Sundar Dorai-Raj
use gregexpr and paste aze - paste(c(a, z, e), collapse = ) sequence - paste(c(a,z,e,r,t,a,z,a,z,e,c), collapse = ) gregexpr(aze, sequence, fixed = TRUE) [[1]] [1] 1 8 attr(,match.length) [1] 3 3 HTH, --sundar On Fri, Jun 5, 2009 at 6:22 AM, Ptit_Bleuptit_b...@yahoo.fr wrote: Hello,

Re: [R] error message re: max(i), but code and output seen O.K.

2009-05-20 Thread Sundar Dorai-Raj
This error is thrown if the argument to max is either NULL or length zero: [~] Rscript -e max(NULL) [1] -Inf Warning message: In max(NULL) : no non-missing arguments to max; returning -Inf [~] Rscript -e max(numeric(0)) [1] -Inf Warning message: In max(numeric(0)) : no non-missing arguments to

Re: [R] what is wrong with this code?

2009-05-19 Thread Sundar Dorai-Raj
You're missing a ) off end of the first line. You should consider using an editor (e.g. ESS/Emacs) that does parentheses matching. I found this in less than 5 sec (less time than I'm taking to write you a note) by cut and pasting in Emacs. --sundar On Tue, May 19, 2009 at 12:52 PM, deanj2k

Re: [R] convert large integers to hex

2009-05-07 Thread Sundar Dorai-Raj
Copyright 1991-1994, 1997, 1998, 2000 Free Software Foundation, Inc. This is free software with ABSOLUTELY NO WARRANTY. For details type `warranty'. x=6595137340052185552 obase=16 x 5B86A277DEB9A1D0 You can call this from R. On Wed, May 6, 2009 at 3:26 PM, Sundar Dorai-Raj sdorai

[R] convert large integers to hex

2009-05-06 Thread Sundar Dorai-Raj
Hi, I'm wondering if someone has solved the problem of converting very large integers to hex. I know about format.hexmode and as.hexmode, but these rely on integers. The numbers I'm working with are overflowing and losing precision. Here's an example: x - 6595137340052185552 # stored as

Re: [R] setting trellis auto.key color values

2009-05-05 Thread Sundar Dorai-Raj
Set the colors in graph.sets and not auto.key. graph.sets - list(axis.text = list(cex = 0.65), par.ylab.text = list(cex = 1.25), par.xlab.text = list(cex = 1.25), superpose.polygon = list(col = 3:5)) Then remove the col = 3:5 from auto.key and barchart.

Re: [R] evaluate a expression

2009-05-02 Thread Sundar Dorai-Raj
Hi, Ning, Try: eval(parse(text = expr)) HTH, --sundar On Sat, May 2, 2009 at 5:39 AM, Ning Ma pnin...@gmail.com wrote: Hi, I am new to R. Can anyone tell me how to evaluate an expression stored in a string? such as: expr - 3*5 I want to get the result 15. Thanks in advance.

Re: [R] Flipping axes of qqnorm

2009-04-26 Thread Sundar Dorai-Raj
Try (re)reading ?qqnorm. Use datax = TRUE. --sundar On Sun, Apr 26, 2009 at 4:37 PM, Chris_d dewhurstch...@gmail.com wrote: Hi all,       I have just started using R to produce qqnorm plots. I am trying to switch the x and y axes so that the theoretical values are plotted on the y axis and

Re: [R] Cannot clean infinite values

2009-04-26 Thread Sundar Dorai-Raj
Use ?is.infinite inf - is.infinite(data) data[inf] - 0.3 * sign(data[inf]) On Sun, Apr 26, 2009 at 5:44 PM, Nigel Birney na...@cam.ac.uk wrote: Hello all, I have to import numeric data from file but found it contains Infinite values which need to be eliminated. I tried to replace them in

Re: [R] Setting lattice par parameters

2009-04-23 Thread Sundar Dorai-Raj
Because you're not calling trellis.par.set correctly. It should be: trellis.par.set(par.ylab.text = list(cex = 0.65), par.xlab.text = list(cex = 0.65)) However, I usually do things like this: my.theme - list(par.ylab.text = list(cex = 0.65), par.xlab.text = list(cex = 0.65)) barchart(...,

Re: [R] question on using lattice panel plots

2009-04-16 Thread Sundar Dorai-Raj
Try: z - cbind(rep(c(BIC, hist), each = 150), rep(rep(c(5, 10, 30), each = 50),2)) z - as.data.frame(z) z - cbind(z, runif(300)) names(z) - c(Method, sigma, Error) z$sigma - factor(z$sigma, c(5, 10, 30)) library(lattice) sigma - as.numeric(levels(z$sigma)) sigmaExprList - lapply(sigma,

Re: [R] question on using lattice panel plots

2009-04-16 Thread Sundar Dorai-Raj
, ...) }, layout = c(3,1)) Not sure how to do this with strip.custom. --sundar On Thu, Apr 16, 2009 at 1:20 PM, Sundar Dorai-Raj sdorai...@gmail.com wrote: Try: z - cbind(rep(c(BIC, hist), each = 150), rep(rep(c(5, 10, 30), each = 50),2)) z - as.data.frame(z) z - cbind(z, runif(300

Re: [R] Changing the y-axis units of a lattice histogram

2009-04-03 Thread Sundar Dorai-Raj
Try: library(lattice) histogram( ~ height | voice.part, data = singer, type = c, scales = list(y = list(at = seq(0, 20, 5), labels = seq(0, 200, 50 HTH, --sundar On Fri, Apr 3, 2009 at 2:01 PM, Judith Flores jur...@yahoo.com wrote: Hello,

Re: [R] labeling panels in lattice plots

2009-03-31 Thread Sundar Dorai-Raj
Try converting year to a factor xyplot(min + max + ave ~ month | factor(year), data = rain.stats, ...) Also, notice the inclusion of the data argument. HTH, --sundar On Tue, Mar 31, 2009 at 6:28 AM, steve_fried...@nps.gov wrote: I am using windows XP with R 2.8.1 I am generating a

Re: [R] Can not get a prediction interval from Predict

2009-03-31 Thread Sundar Dorai-Raj
?predict.glm has no interval argument. Perhaps you're thinking of ?predict.lm, which is different. To get intervals in glm, I've used: example(predict.glm) pr - predict(budworm.lg, se.fit = TRUE) family - family(budworm.lg) lower - family$linkinv(pr$fit - qnorm(0.95) * pr$se.fit) upper -

Re: [R] use R Group SFBA April meeting reminder; video of Feb k

2009-03-30 Thread Sundar Dorai-Raj
Could be that you have some sort of ad filter in your browser that's blocking the video? It appears just fine for me in Firefox 3. On Mon, Mar 30, 2009 at 3:55 PM, Ted Harding ted.hard...@manchester.ac.uk wrote: On 30-Mar-09 22:13:04, Jim Porzak wrote: Next week Wednesday evening, April 8th,

Re: [R] Requesting help with lattice again

2009-03-25 Thread Sundar Dorai-Raj
For the first question, add a groups argument. E.g. barchart(HSI ~ Scenario | Region, Wbirdsm, groups = HydroState) Also note that using Wbirdsm$HSI makes your call less readable, so I added the data argument. For your second question, setting the key does not set the color theme. You want to

Re: [R] XYplot simple question

2009-03-16 Thread Sundar Dorai-Raj
Convert Plot to factor: xyplot(AbvBioAnnProd ~ Year | Plot, type = c(b, r), pch = 16) Also note that using the type argument with multiple values prevents the necessity of a custom panel function. HTH, --sundar On Mon, Mar 16, 2009 at 5:54 AM, AllenL allen.laroc...@gmail.com wrote: Hello R

Re: [R] XYplot simple question

2009-03-16 Thread Sundar Dorai-Raj
Sorry, I should have xyplot(AbvBioAnnProd ~ Year | factor(Plot), type = c(b, r), pch = 16) On Mon, Mar 16, 2009 at 6:17 AM, Sundar Dorai-Raj sdorai...@gmail.com wrote: Convert Plot to factor: xyplot(AbvBioAnnProd ~ Year | Plot, type = c(b, r), pch = 16) Also note that using the type

Re: [R] Get user system name

2009-03-16 Thread Sundar Dorai-Raj
Assuming USER is defined on your system then Sys.getenv(USER) ought to work. --sundar On Mon, Mar 16, 2009 at 3:04 PM, Etienne Bellemare Racine etienn...@gmail.com wrote: I would like to get the name of the user form the system. Is it possible ? Something like  system.user() returning

Re: [R] Get user system name

2009-03-16 Thread Sundar Dorai-Raj
. Is there a workaround or another solution ? -- Etienne Sundar Dorai-Raj a écrit : Assuming USER is defined on your system then Sys.getenv(USER) ought to work. --sundar On Mon, Mar 16, 2009 at 3:04 PM, Etienne Bellemare Racine etienn...@gmail.com wrote: I would like to get the name

Re: [R] Matrix Construction; Subdiagonal

2009-03-11 Thread Sundar Dorai-Raj
Does this help? A - matrix(0, 6, 6) vec - 1:5 A[row(A) == col(A) + 1] - vec --sundar On Wed, Mar 11, 2009 at 4:42 PM, Stu Field s...@colostate.edu wrote: I'm trying to enter a vector into the subdiagonal of a matrix but cannot find a command in R which corresponds to the MatLab version of

Re: [R] Matrix Construction; Subdiagonal

2009-03-11 Thread Sundar Dorai-Raj
, thanks. But I guess I was looking for something more similar to MatLab, I'm really surprised R doesn't have a preset command for this (?) Thanks again, Stu On 11 • Mar • 2009, at 5:49 PM, Sundar Dorai-Raj wrote: Does this help? A - matrix(0, 6, 6) vec - 1:5 A[row(A) == col(A) + 1] - vec

Re: [R] Lattice: Customizing point-sizes with groups

2009-03-10 Thread Sundar Dorai-Raj
Try this: xyplot(y ~ x, temp, groups = groups, par.settings = list( superpose.symbol = list( cex = c(1, 3), pch = 19, col = c(blue, red See: str(trellis.par.get()) for other settings you might want to change. Also, you should drop the ;

Re: [R] Lattice: Customizing point-sizes with groups

2009-03-10 Thread Sundar Dorai-Raj
= temp$cex, col = temp$col, pch = 19); Once I introduce groups, I lose the ability to customize individual data-points and seem only to be able to customize entire groups. Paul -Original Message- From: Sundar Dorai-Raj [mailto:sdorai...@gmail.com] Sent: Tuesday, March 10, 2009 5:49

Re: [R] 2 Simple Lattice Plot Questions

2009-03-10 Thread Sundar Dorai-Raj
Convert Year to a factor and both problems will be solved. --sundar On Tue, Mar 10, 2009 at 3:48 PM, jimdare jamesdar...@gmail.com wrote: Hi, I have created the plot below and have a few questions about changes. 1) How do I change the Year title of each plot so it reads from the top

Re: [R] 2 Simple Lattice Plot Questions

2009-03-10 Thread Sundar Dorai-Raj
I don't believe Elena's suggestion will work. However, the following will: xyplot(..., scales = list(y = list(at = seq(5, 25, 5 though you may need to extend the limits a little as well: xyplot(..., ylim = lattice:::extend.limits(c(0, 30))) and add the scales argument from the first

Re: [R] Date conversion

2009-03-05 Thread Sundar Dorai-Raj
Hi, There are possibly several ways to do this. My approach would be: dates - strptime(as.character(DATE), %d%b%Y) year - dates$year + 1900 week - floor(dates$yday/365 * 52) HTH, --sundar On Thu, Mar 5, 2009 at 8:58 AM, Pele drdi...@yahoo.com wrote: Hi R users, I have a factor variable

Re: [R] lattice: remove box around a wireframe

2009-03-04 Thread Sundar Dorai-Raj
(Sorry for the repeat. Forgot to copy R-help) Try, test = data.frame(expand.grid(c(1:10), c(1:10))) z = test[,1] + test[,2] test = cbind(test, z) names(test) = c(x, y, z) require(lattice) wireframe(z ~ x*y, data = test, par.settings = list(axis.line = list(col = transparent)), par.box = c(col

Re: [R] levelplot help needed

2009-02-27 Thread Sundar Dorai-Raj
To reorder the y-labels, simply reorder the factor levels: df - data.frame(x_label = factor(x_label), y_label = factor(y_label, rev(y_label)), values = as.vector(my.data)) Not sure about putting the strips at the bottom. A quick scan of ?xyplot and

Re: [R] lattice contourplot line types

2009-02-22 Thread Sundar Dorai-Raj
The only way I can figure out to do this is to use two calls to panel.contourplot: library(lattice) x - seq(-2, 2, length = 20) y - seq(-2, 2, length = 20) grid - expand.grid(x=x, y=y) grid$z - dnorm(grid$x) * dnorm(grid$y) contourplot(z ~ x * y, grid, panel = function(at, lty, col,

Re: [R] Uninstall question

2009-02-17 Thread Sundar Dorai-Raj
This is on the Mac FAQ: http://cran.cnr.berkeley.edu/bin/macosx/RMacOSX-FAQ.html#How-can-R-for-Mac-OS-X-be-uninstalled_003f HTH, --sundar On Tue, Feb 17, 2009 at 7:17 AM, ANJAN PURKAYASTHA anjan.purkayas...@gmail.com wrote: I need to uninstall R 2.7.1 from my Mac. What is the best way to

Re: [R] Adding abline in Lattice graph

2009-02-12 Thread Sundar Dorai-Raj
Try: coplot(lbxglu~lbxgh|eth, data = reg.dat.5, panel= function(...) { panel.smooth(...) panel.abline(h = 126, col = red) panel.abline(v = 6.5, col = blue) }, xlab=ABC, ylab=FBG) Also note that you removed your with call and give coplot a data argument. HTH, --sundar On

Re: [R] Adding abline in Lattice graph

2009-02-12 Thread Sundar Dorai-Raj
, Sundar Dorai-Raj sdorai...@gmail.com wrote: Try: coplot(lbxglu~lbxgh|eth, data = reg.dat.5, panel= function(...) { panel.smooth(...) panel.abline(h = 126, col = red) panel.abline(v = 6.5, col = blue) }, xlab=ABC, ylab=FBG) Also note that you removed your with call and give

Re: [R] changing settings on a barchart (lattice)

2009-02-11 Thread Sundar Dorai-Raj
! Dimitri On Wed, Feb 11, 2009 at 12:46 PM, Sundar Dorai-Raj sdorai...@gmail.com wrote: Pass a list to xlab and main for the font sizes: barchart(..., xlab = list(x-axis, cex = 2), main = list(title, cex = 2)) For value labels and a grid you'll need a custom panel function: barchart(..., panel

Re: [R] Efficent way to create an nxn upper triangular matrix of one's

2009-02-11 Thread Sundar Dorai-Raj
Try x - diag(n) x[upper.tri(x)] - 1 On Wed, Feb 11, 2009 at 1:22 PM, Dale Steele dale.w.ste...@gmail.com wrote: The code below create an nxn upper triangular matrix of one's. I'm stuck on finding a more efficient vectorized way - Thanks. --Dale n - 9 data - matrix(data=NA, nrow=n, ncol=n)

Re: [R] sapply

2009-02-08 Thread Sundar Dorai-Raj
I'm not sure what you really want, so perhaps a simple example would help (i.e. what a sample of the input looks like and what the output you need looks like). My guess would be sapply(df, diff) but again, I'm not sure. --sundar On Sun, Feb 8, 2009 at 4:24 PM, glenn

Re: [R] subsets problem

2009-02-08 Thread Sundar Dorai-Raj
you can try lapply(lapply(uniques, function(x) subset(df, date == x)), myfun) or possibly more accurate (subset may be finicky due to scoping): lapply(lapply(uniques, function(x) df[df$date == x, ]), myfun) or use ?split lapply(split(df, df$date), myfun) HTH, --sundar On Sun, Feb 8, 2009

Re: [R] Foreign function call

2009-02-04 Thread Sundar Dorai-Raj
You're missing that R_TSConv is an R object. You can use stats:::R_TSConv to see the value. Not sure how this helps you though. On Wed, Feb 4, 2009 at 10:08 AM, rkevinbur...@charter.net wrote: Let me get more specific. I think it this can be answered then I can translate the information to

Re: [R] color and fontfamily in lattice

2009-02-03 Thread Sundar Dorai-Raj
Try this: dados - data.frame(varsep = factor(rep(1:2,10)), i = runif(20)) library(lattice) font.settings - list( font = 2, cex = 2, fontfamily = serif) my.theme - list( box.umbrella = list(col = red), box.rectangle = list(col =

Re: [R] xyplot with lowess curves

2009-02-02 Thread Sundar Dorai-Raj
You'll need a custom panel function. It would also help if you provided a reproducible example: xyplot ( SnowLineElevation ~ Year | Model, data = data, panel = function(x, y, col, ...) { col - ifelse(panel.number() == 1, red, green) panel.xyplot(x, y, col = blue, ...)

  1   2   >