Re: [R] Reading data entered within an R program

2009-07-11 Thread milton ruser
*hum* I prefer stdin() because you not need to explain to your student or beginners about TextConnection. cheers milton On Sat, Jul 11, 2009 at 4:38 PM, Muenchen, Robert A (Bob) muenc...@utk.eduwrote: Dear R-helpers, I know of two ways to reading data within an R program, using

Re: [R] plm Issues

2009-07-11 Thread milton ruser
The first think one need to do when has a so old version, is update it :-) After, if the problem remain, try get help with the colleagues. best milton On Thu, Jul 9, 2009 at 10:58 AM, Damien Moore damienlmo...@gmail.comwrote: Hi List I'm having difficulty understanding how plm should work

[R] Renviron.in error when compiling R 2.9.1 under Debian.

2009-07-16 Thread milton ruser
Dear all, I'm trying to compile R 2.9.1 on my home directory under debian, and as I need to play with RPy, I tryed compile R using: ./configure --enable-R-shlib But, during the compilation, I get the error below: - using as R_SHELL for scripts ... /bin/sh

Re: [R] Renviron.in error when compiling R 2.9.1 under Debian.

2009-07-16 Thread milton ruser
Dear R-friends, I removed the directory, untarzed the source files and now I can compile the R. Thanks for those suggested it off-list. Bests milton On Thu, Jul 16, 2009 at 6:08 PM, milton ruser milton.ru...@gmail.comwrote: Dear all, I'm trying to compile R 2.9.1 on my home directory

Re: [R] Entire Organization Switching from SAS to R - Any experience?

2009-07-16 Thread milton ruser
*hum* How much of the employes of your institute use statistical softwares? 1-5? 5-20? 20-50? I think a brief description could help on the discussion. cheers milton On Thu, Jul 16, 2009 at 5:40 PM, Kel Lam lamk...@gmail.com wrote: My institute has been heavily dependent on SAS for the past

Re: [R] get a vector with filenames with a certain extension in a folder

2009-07-16 Thread milton ruser
Hi there, try this: setwd(/home/mcr) dir(path=., pattern=.txt$) OR dir(path=/home/mcr/., pattern=.txt$) $ means finished with .txt good luck, milton brazil=toronto On Fri, Jul 17, 2009 at 12:08 AM, torpedo fisken torpedofis...@gmail.comwrote: Hi I got a script that works on file with

Re: [R] Normalize data

2009-07-20 Thread milton ruser
require(vegan) library(help=vegan) :-) On Mon, Jul 20, 2009 at 2:03 PM, Noah Silverman n...@smartmediacorp.comwrote: Hello, I'm coming from RapidMiner, so some of the easy things there are a bit difficult for me to find in R How do I normalize data in a data frame. Ideally I want to

Re: [R] How to extract the upper xlim and ylim of my plot?

2009-07-21 Thread milton ruser
May be: text(.1*max(all$AREA),.9*max(all$SR),text to be placed) ? bests milton On Tue, Jul 21, 2009 at 5:03 PM, Mark Na mtb...@gmail.com wrote: Dear R-helpers, I wish to place some text in a plot, at approx 10% of my upper xlim and approx 90% of my upper ylim, i.e.

Re: [R] Calculate weighted mean for each group

2009-07-23 Thread milton ruser
try your first reproducible line first :-) On Thu, Jul 23, 2009 at 5:18 PM, Alexis Maluendas avmaluend...@gmail.comwrote: Hi R experts, I need know how calculate a weighted mean by group in a data frame. I have tried with aggragate() function:

Re: [R] a question about replacing a column that is factor

2009-07-24 Thread milton ruser
May be you want something like: FDLFDPdata[FDLFDPdata$ID==69912008,]$tempcalved2-'2008-03-08' FDLFDPdata$tempcalved2-factor(FDLFDPdata$tempcalved2) ## the factor above just update the levels Case this is what you want, you can also change $ID==69912008 $ID %in% c(69912008,)

Re: [R] Deleting .RData files

2009-07-25 Thread milton ruser
Be carefull with this, but: rm(list=ls()) q(yes) :-) milton On Sat, Jul 25, 2009 at 7:19 AM, Paul Emberson em...@calidasoft.co.ukwrote: Hi John, You can use rm(object) to delete a specific object from the current environment and then save your workspace again without those objects

Re: [R] Question regarding sqldf

2009-07-30 Thread milton ruser
Hi Rizzi, how about a reproducible example/data.frame? :-) milton On Thu, Jul 30, 2009 at 1:46 PM, rizzo.mich...@epamail.epa.gov wrote: Hello, I am having a problem using sqldf. I'm trying to choose a subset of observations from a data set based on the date and maximum value of a

Re: [R] Question regarding sqldf

2009-07-30 Thread milton ruser
How about update R/sqldf? require(sqlf) Loading required package: sqlf Warning message: In library(package, lib.loc = lib.loc, character.only = TRUE, logical.return = TRUE, : there is no package called 'sqlf' testframe-data.frame(sdate=rep(paste +

Re: [R] Re ferencing columns and pulling selected data

2009-08-04 Thread milton ruser
Hi there, It may not be so ellegant, but you can try: PrsnData-data.frame(cbind(PrsnSerialno,PrsnAge,IsHead)) PrsnData.subset-subset(PrsnData, PrsnSerialno %in% HhSerialno) PrsnData.subset PrsnData.subset.maxage-aggregate(PrsnData.subset[PrsnAge], list(PrsnData.subset$PrsnSerialno), max)

Re: [R] Why is 0 not an integer?

2009-08-06 Thread milton ruser
By the way: Are there difference between -0 and 0? On Thu, Aug 6, 2009 at 5:00 PM, Gerlanc, Daniel daniel.gerl...@geodecapital.com wrote: b/c class(0) [1] numeric typeof(0) [1] double class(0L) [1] integer typeof(0L) [1] integer When you call the : function it always

Re: [R] bug with subset and plot?

2009-08-07 Thread milton ruser
hi knut may be: treatment-factor(treatment) plot(...) cheers milton On Fri, Aug 7, 2009 at 6:02 AM, Knut Helge Jensen knut.jen...@bio.uib.nowrote: Hi! I have the following problem that I beleive is a bug: I have a dataframe with one categorical and one numerical vector. The categorical

Re: [R] generalized linear models

2009-08-07 Thread milton ruser
Hi Annie, create a new data.frame with input variables having all predictors variables on it. after give a look at ?predict best wishes milton On Fri, Aug 7, 2009 at 8:19 PM, annie Zhang annie.zhang2...@gmail.comwrote: Hi, R users, I am trying to use glm to do logistic regression. I know

Re: [R] nearest neighbors

2009-08-09 Thread milton ruser
Hi cindy, depends on your data type. It it is points, give a look at spatstat package. bests milton On Sun, Aug 9, 2009 at 5:03 PM, cindy Guo cindy.g...@gmail.com wrote: Hi, All, I am wondering if there is any package which can give the index of the k nearest neighbors. Thank you,

Re: [R] Reading data in R-metrics

2008-08-02 Thread milton ruser
John, I suspect that Patrick is right. send us a str(df) to we see how your data frame looks like kind regards miltinho astronaura brazil On 8/1/08, Kerpel, John [EMAIL PROTECTED] wrote: Hi Folks! I used the code below previously with no problems, but now I get:

Re: [R] Create data frame from header only

2008-08-04 Thread milton ruser
Hi Etienne It is not so elegant, bu I think that work. colname.list-paste(A,1:5,sep=) df-data.frame(matrix(matrix(rep(1,length(colname.list)),1),1)) df colnames(df)-colname.list df df-df[-1,] df Cheers, Miltinho Astronauta Brazil On 8/4/08, Etienne Bellemare Racine [EMAIL PROTECTED]

Re: [R] subsetting with column name as string

2008-08-06 Thread milton ruser
Try this foo1 = function(val) { return(d[val]) } foo1(x) Good luck miltinho astronauta brazil On 8/6/08, Faheem Mitha [EMAIL PROTECTED] wrote: Hi, Consider the following x = c(1,2) y = c(3,4) d = data.frame(cbind(x,y)) d$x [1] 1 2 d$x [1] 1 2 foo = function(val)

Re: [R] How Can I Tell if the R Running is 64 bit or 32 bit?

2008-08-08 Thread milton ruser
Dear Prof. B.Ripley, If : .Machine$sizeof.pointer [1] 4 2*2*2*2 [1] 16 So I am running with 16 bits? How can I know the number of bits supported on my machine? Kindly, miltinho astronauta brazil On 8/8/08, Prof Brian Ripley [EMAIL PROTECTED] wrote: Look at .Machine$sizeof.pointer (in

Re: [R] aggregate

2008-08-08 Thread milton ruser
Dear Sherri Heck, Try something like: my.df-read.table(stdin(), head=T, sep=,) doy,yr,mon,day,hr,hgt1,hgt2,hgt3,co21,co22,co23,sig1,sig2,sig3,dif,flag 244.02083,2005,09,01,00,2.6,9.5,17.8,375.665,373.737,373.227,3.698,1.107,0.963,-0.509,PRE

Re: [R] import/export txt file

2008-08-08 Thread milton ruser
Dear Alessando, I don´t know if I understood well your question, but my be you are not losting the precision. Try change the options(digits=10). If you want to output with , as sepatator, try something like write.table(testground, my_output.txt, sep=,, append=F, quote=F, row.names=F) but if you

Re: [R] Anova

2008-08-12 Thread milton ruser
Dear Daniel, Are you really interested on the analyzis of the effect of ML on Grup, our on the effect of Grup on ML? I reproduce your sample database, but changed some Grup values from 1 to 2 to allow an analysis of variance. See the example below. Vale! miltinho astronaura Brazil

[R] changing plot font for Times new roman

2008-08-18 Thread milton ruser
Dear all, I know that it is a know issue, but I would like to change the type of font on my plot, and I am not sure the rigth way. I would like to use Times New Roman font, but according to the par() help, some device allow we choose an family of fonts. I tryed par(family=times) without success.

Re: [R] How to learn R language?

2008-08-27 Thread milton ruser
Dear Sagga, How give a look at the introduction material on Help / Manual (in pdf) / An introduction to R HTH miltinho astronauta brazil On 8/27/08, saggak [EMAIL PROTECTED] wrote: Hi! I am a post graduate in Statistics. I want to learn R language, but am very confused as to how to begin

Re: [R] How to create additional columns?

2008-08-27 Thread milton ruser
Dear Kayj Try something like setwd(c:\\temp) require(MASS) my.df-read.table(my_inputfile.txt, sep=\t, head=T) my.df$newcol-my.df$col1+my.df$col2+my.df$col3 write.table(my.df, my_outputfile.txt, append=F, row.names=F, sep=\t) On the above example, I suppose that your input file are on c:\temp

Re: [R] remove levels from a factor

2008-08-29 Thread milton ruser
Hi Yuan, It is not ellegant, but may work for you.. f-as.factor(c(a,b,a)) f.freq-data.frame(table(f)) f.freq lower.freq-2 f.freq.subset-subset(f.freq,f.freq$Freq=lower.freq) f.freq.subset f.selected-f[f %in% f.freq.subset$f] f.selected-factor(f.selected) f.selected Best wishes, miltinho

Re: [R] Mode value

2008-09-06 Thread milton ruser
Hi Carolos, I know that it is not a elegant soluction, but may work. Almost for integer values. Take care with float values. modevalue-function(x) { x.freq-data.frame(table(x)) x.freq.max-max(x.freq$Freq) x.freq.selected-subset(x.freq, x.freq$Freq==x.freq.max)

Re: [R] (no subject)

2008-09-08 Thread milton ruser
Dear Jason, If I understood, you are looking for a way of represent a response surface. I know that there are other very interesting (and most indicated) solutions, but give a look at the akima package Best wishes, miltinho astronauta brazil === x-runif(100) y-rnorm(100)

[R] isolating X on an expression

2008-09-10 Thread milton ruser
Dear R-gurus, I know that it is not a R problem, but as need to implement some solution for this on R, I would like to know if someone help me on how to isolate X on the expression below. K=(sen A * sen B ) + ( cos A * cos B * cos ( X - Y ) ) Any help are welcome mitinho astronauta brazil

Re: [R] re flecting a line

2008-09-10 Thread milton ruser
Hi David, I don´t know if I got what you are looking for. But see the code below. x-1:100 y-x+(runif(100)*x) plot(y~x) mymod-glm(y~x) my.coefs-coef(mymod) my.coefs curve(my.coefs[1]+my.coefs[2]*x, lwd=2, col=red, add=T) Cheers, mitinho astronauta brazil On Wed, Sep 10, 2008 at 6:06 PM,

Re: [R] making spearman correlation cor() call fail with log(0) as input

2008-09-10 Thread milton ruser
Hi Timur, try cor(log(a+1), log(b+1), method=pearson) HTH, miltinho brazil On Wed, Sep 10, 2008 at 6:04 PM, Timur Shtatland [EMAIL PROTECTED]wrote: Hi, How can I make the cor(x, y, method=spearman) call to produce an error when the input to it (x, y) produces an error? Here is a simple

Re: [R] Problemas con JRI

2008-09-11 Thread milton ruser
pseudo-Transation: Hi, my name is Angel, and I am making an Java´s application that use some fuctions available on R. I am sorry for this, but I can´t bypass the intallation step of JRI´s package. I will be very happy if someone help on this task. I read the JRI´s documents that is absent (no

Re: [R] point with change of tendecy

2008-09-12 Thread milton ruser
Dear Ramon, I don´t know anything about time series, but if you are looking for to identify thresholds (i.e. breaking points ; broken stick ; piece-wise regression) segmented package may help you. Cheers, miltinho astronauta brazil On Fri, Sep 12, 2008 at 9:39 AM, Ramon Hidalgo [EMAIL

Re: [R] inserting values for null

2008-09-17 Thread milton ruser
Dear Raja, Give a look on merge() function. Case you need more help, send us a short sample of your D.F1 and DF.sub.2 dataframes. Hope this helps, best wishes, miltinho astronauta brazil On Wed, Sep 17, 2008 at 2:13 PM, Rajasekaramya [EMAIL PROTECTED]wrote: I have a dataframe D.F1 dim

Re: [R] Need help creating spatial correlation for MC simulation

2008-09-17 Thread milton ruser
Dear J.J.Harden I think that on spatial stat you will find several ways of simulate spatial pattern that (point or line) that may be what you are looking for. Case not, please let me know and may be we can improve some solution. Best wishes, miltinho astronauta brazil On Wed, Sep 17, 2008 at

[R] AUC / ROC for presence only.

2008-09-19 Thread milton ruser
Dear all, I have a probability of presence of distribution of a species of interest (varying from 0 to 1 in continuous form) and I have a set of points where I know that species really occurs. But I don´t have points of absence. So, for each true presence I know the estimated presence. I

Re: [R] climatological standard deviation

2008-09-24 Thread milton ruser
Dear Yogesh, Send us a minimal reproducive code, with a sample of your data structure. It will help us to help you :-) Best wishes, miltinho astronauta brazil On Wed, Sep 24, 2008 at 2:00 AM, Yogesh Tiwari [EMAIL PROTECTED]wrote: Hello R users, I have a montly time series over a several

Re: [R] save workspace while running R on a cluster

2008-06-12 Thread milton ruser
Hi Manisha, How about you incluse something like this on your script.R: setwd(/your/full/working/directory) # ?setwd save.image()# or save.image(your_workspace.RDA). By the way, I don´t know if you added the line below to run in background: R --save calculate.R script.out May be the

Re: [R] Delete Block of Rows

2008-06-15 Thread milton ruser
Hi there, I don´t know if you are trying to solve the delete job or to test how functions work. If you really want to delete lines from a data.frame, try something like this. rowcount-1:100 x-runif(100) y-runif(100) df-data.frame(cbind(rowcount,x,y)) df.subset-subset(df, !(rownames(df) %in%

Re: [R] Delete Block of Rows

2008-06-16 Thread milton ruser
, thanks for the help! milton ruser wrote: Hi there, I don´t know if you are trying to solve the delete job or to test how functions work. If you really want to delete lines from a data.frame, try something like this. rowcount-1:100 x-runif(100) y-runif(100) df

Re: [R] Importing data with different delimters

2008-06-16 Thread milton ruser
Hi David, If the delimier is tab try this. my.df-read.table(my_file.txt, head=T, sep=\t) Cheers, Miltinho Brazil -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of David Arnold Sent: Friday, June 13, 2008 5:15 PM To: r-help@r-project.org

Re: [R] Draw curve for histogram

2008-06-19 Thread milton ruser
Hi Anh, How about the reply by Dimitris? Kind regards, miltinho Brazil -- Forwarded message -- From: Dimitris Rizopoulos [EMAIL PROTECTED] Date: Jun 16, 2008 4:05 AM Subject: Re: [R] Superimposing Line over Histogram in Density Plot To: Gundala Viswanath [EMAIL PROTECTED] Cc:

Re: [R] Advanced Filtering problem

2008-06-19 Thread milton ruser
Hi Tyler, I don´t know if I understood well. Try this. Case not work I try again and again :-) df-read.csv(http://www.nabble.com/file/p18018170/subdata.csv;) df.min.diff-aggregate(df[diff], df[c(day)], min) df.subset-subset(df, paste(df$day, df$diff) %in% paste(df.min.diff$day,

Re: [R] Scatter plot transparency

2008-06-20 Thread milton ruser
Hi Anh, I don´t know if I understood your point fine. I generate a scatterplot, and open it on adobe photoshop 7.0 with tranparent background. setwd(c:\\temp) x-runif(100) y-rnorm(100) png(transparent_scatterplot.png, 800, 600, bg=transparent) plot(y~x) dev.off() I hope this help, miltinho

[R] clicking on plot and recording XY coords

2008-06-20 Thread milton ruser
Dear all, I need to run a interactive procedure where the user will need click on the screen (over a XY plot) and I need to record the XY coordinate which the user clicked. Roughly I wrote a short code below. You see that I suppose that the user will choose four coordinates inside the region of

Re: [R] clicking on plot and recording XY coords

2008-06-20 Thread milton ruser
Thanks Jim. I included your suggestion on the script and run fine. But how can I skip (record X and Y as NULL) on some steps? On this example it don´t occour, but when working with real data I will need bypass some acquisitions. Is there a way of do it on a for() looping? I noticed that if I

Re: [R] clicking on plot and recording XY coords

2008-06-20 Thread milton ruser
not have a NULL in the series. On Fri, Jun 20, 2008 at 11:56 PM, milton ruser [EMAIL PROTECTED] wrote: Thanks Jim. I included your suggestion on the script and run fine. But how can I skip (record X and Y as NULL) on some steps? On this example it don´t occour, but when working

[R] eliminating string from a char vector

2008-06-21 Thread milton ruser
Hi there, I have a list of filenames like a-c(file1.dbf, file32.dbf, myfile_temp.dbf) and I would like to remove the .dbf string from all records and obtain somethink like file1 file32 myfile_temp Thanks in advance, miltinho brazil [[alternative HTML version deleted]]

Re: [R] I can't see plots

2008-06-22 Thread milton ruser
Hi there, try to open a graphic device with x11(), may be. cheers, miltinho On 6/22/08, Josep Lluís Figueras [EMAIL PROTECTED] wrote: Hi, I am using RSPerl package on Ubuntu and Apache2 web server. It is my first experience with R language :-) I have the next code embedded into a Perl

Re: [R] Correlation Help

2008-06-23 Thread milton ruser
Hi Michael, May be you have NA on your dataset. x-runif(20) y-runif(20) cor(x,y) x[10]-NA x cor(x,y) # SEE the error because NA cor(x,y, use = pairwise.complete.obs) Good luck, miltinho brazil On 6/23/08, Tong, Michael [EMAIL PROTECTED] wrote: Hi, I have recently been using the R

Re: [R] R help on for loop

2008-06-24 Thread milton ruser
Hi Ramya. Like this? for ( i in 1:nrow(map) ) { cat (this is the line, i, \n) } Miltinho. Brazil On 6/24/08, Rajasekaramya [EMAIL PROTECTED] wrote: hi, I have a data stored in table format. The data is stored in the name map. 500545 rows and 3 columns. I want to use a for loop to

Re: [R] Find max of a row in data frame (like Excel)

2008-06-24 Thread milton ruser
Hi Anh, I know that it is not so elegant, but may work. x-runif(10) y-runif(10)*2 z-runif(10)*3 df-data.frame(cbind(x,y,z)) df df$f-NULL for (i in 1:nrow(df)) { df[i,f]-max(c(df[i,x],df[i,y],df[i,z])) } Of course, others that know better apply family will solve if with a line :-) There

Re: [R] density and jpeg

2008-06-26 Thread milton ruser
Hi Geord, I run the code bellow without problem on R R version 2.6.2 (2008-02-08) i386-pc-mingw32 require(lattice) setwd(c:\\temp) jpeg(test.jpeg) d-runif(10) d[1:10] densityplot(~d[1:10]) dev.off() Good luck with Mac! miltinho On 6/26/08, Georg Ehret [EMAIL PROTECTED] wrote: Dear R

[R] Fwd: converting numbers to characters

2008-06-27 Thread milton ruser
Hi Lana, I think it could help you (following the answer by Paulo Justiniano on last week) x-1e+05 x as.character(x) options(scipen=1) x-1e+05 x as.character(x) ?options Kind regards, miltinho brazil On 6/27/08, Lana Schaffer [EMAIL PROTECTED] wrote: Hi, I need to convert numbers to

Re: [R] trying to superimpose a line plot onto a histogram

2008-07-05 Thread milton ruser
How about the answer by Demitris? Regards a lot, miltinho From: Dimitris Rizopoulos [EMAIL PROTECTED] Date: Jun 16, 2008 4:05 AM Subject: Re: [R] Superimposing Line over Histogram in Density Plot To: Gundala Viswanath [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] try something like this: x -

Re: [R] Numbers as Points in Graphs

2008-07-06 Thread milton ruser
Hi Hippien Dream If I understood, the code below may help you. Cheers, Miltinho Astronauta Brazil === x-runif(20) y-rnorm(20) df-data.frame(cbind(x,y)) par(mfrow=c(1,2)) plot(y~x, data=df) plot(y~x, data=df, type=n) text(df$x, df$y, o.o) On 7/6/08, hippie dream [EMAIL PROTECTED]

Re: [R] Numbers as Points in Graphs

2008-07-06 Thread milton ruser
? Thanks again. milton ruser wrote: Hi Hippien Dream If I understood, the code below may help you. Cheers, Miltinho Astronauta Brazil === x-runif(20) y-rnorm(20) df-data.frame(cbind(x,y)) par(mfrow=c(1,2)) plot(y~x, data=df) plot(y~x, data=df, type=n) text(df$x, df$y, o.o

Re: [R] Sorting a list

2008-07-07 Thread milton ruser
foo[sort.list(unlist(foo))] may help you, but I think that this is not your final solution. Cheers, miltinho astronauta brazil On 7/7/08, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Dear R Users, A bit of a simple question, but I could not find the answer thru google (sorting lists r

Re: [R] package segmented problem

2008-07-09 Thread milton ruser
Hi Alan How your lm model looks like? Are your data stored on a data.frame ? Case yes, send us a str(df). Send us a short sample of the code and a short subset of the data. Cheers, miltinho astronauta brazil On Tue, Jul 8, 2008 at 5:36 AM, Alan Kelly [EMAIL PROTECTED] wrote: Hi, while using

Re: [R] question about a small for loop

2008-07-14 Thread milton ruser
May be this helps: jaw-data.frame(vara=1:20,age=runif(20)) for (i in 2:6) { jaw[paste(agepow,i, sep=)] - jaw[age]^i } jaw-round(jaw,2) # It is just to help the check task Cheers, Miltinho Astronauta Brazil On 7/14/08, Christopher W. Ryan [EMAIL PROTECTED] wrote: R 2.5.1 on

Re: [R] wroung groupedData despite reading Bates and Pinheiro 3 times

2008-07-19 Thread milton ruser
Hi (sorry, I don´t got your name) May be this help you. trap$time-factor(trap$time) trap$block-factor(trap$block) All the best, miltinho astronauta brazil On 7/19/08, hpdutra [EMAIL PROTECTED] wrote: Hi everyone. I am trying to add a formula to my data using the groupedData

[R] estimating volume from xyz points

2008-07-19 Thread milton ruser
Dear all, I have several sets of x-y-z points and I need to estimate the volume that encompass all my points. Recently I got some adivice to show the convex hull of my points using geometry package (see code below). But now I need to calculate the volume of my set of points. Any advice are

Re: [R] How to filter a data frame?

2008-07-22 Thread milton ruser
May be this help you; Just intall.packages(sqldf, dependencies=T) require(sqldf) my_df-data.frame(cbind(gender=sample(c(male,female),50,replace=T), age=round(rnorm(50, mean=30, sd=5),0))) my_df_subset_male-sqldf(select * from my_df where gender=='male') my_df_subset_male

Re: [R] an extremely simple question

2008-07-22 Thread milton ruser
Hi Edna, I am not sure the completely right answer, but I suspect that you use data(df) to invoke a data.frame from the sample datasets provided from the packages available on your R system. By other side, if you have a data.frame loaded on your environent, you can use attach do turn the columns

Re: [R] Can't Load Text Files

2008-07-22 Thread milton ruser
setwd(c:\\temp) #you need to insert a ENTER after your last value df1-read.table(testinput.txt, head=T, sep=\t) df1 Date France Germany 1 3/15/07 1 2 2 3/10/07 2 4 df2-read.table(testdate.txt, head=T, sep=\t) df2 Date 1 3/15/07 2 3/14/07 3 3/13/07 4 3/12/07 5

Re: [R] Using if, else statements

2008-07-23 Thread milton ruser
Just to clarify, if you have two data.frame, one with your data, other with data-admissions, just use data.merge-merge(my.df, data.weigth, by.x=data, by.y=data, all=T) miltinho On 7/23/08, milton ruser [EMAIL PROTECTED] wrote: Hi Rob Williams I think it is one way of you do the job

Re: [R] Histogram

2008-07-23 Thread milton ruser
I don´t know what you means by treat, but may be you want something like my.df-read.table(stdin(), head=T, sep=,) class,frequency 20-23,9 23-25,7 26-28,5 29-31,5 32-34,3 rownames(my.df)-my.df$class barplot (my.df$frequency) axis(1, 1:dim(my.df)[1], rownames(my.df)) Cheers, miltinho astronauta

Re: [R] sum each row and output results

2008-07-23 Thread milton ruser
Like This? my.df-read.table(stdin(), head=T, sep= ) V5 V5.1 V5.2 V5.3 V5.4 V5.5 -5890.18905 -6019.84665 -6211.06545 -6198.9353 -6616.8677 -6498.7183 -5890.18905 -6019.84665 -6211.06545 -6198.9353 -6616.8677 -6498.7183 -5890.18905 -6019.84665 -6211.06545 -6198.9353 -6616.8677 -6498.7183

Re: [R] Sample on dataframe

2008-07-23 Thread milton ruser
I hope this helps my.df-read.table(stdin(), head=T, sep= ) V5 V5.1 V5.2 V5.3 V5.4 V5.5 -5890.18905 -6019.84665 -6211.06545 -6198.9353 -6616.8677 -6498.7183 -5890.18905 -6019.84665 -6211.06545 -6198.9353 -6616.8677 -6498.7183 -5890.18905 -6019.84665 -6211.06545 -6198.9353 -6616.8677 -6498.7183

Re: [R] Histogram

2008-07-23 Thread milton ruser
, milton ruser ha scritto: I don´t know what you means by treat, but may be you want something like my.df-read.table(stdin(), head=T, sep=,) class,frequency 20-23,9 23-25,7 26-28,5 29-31,5 32-34,3 rownames(my.df)-my.df$class barplot (my.df$frequency) axis(1, 1:dim(my.df)[1], rownames

Re: [R] Insert rows into a pre-existing data frame

2008-07-25 Thread milton ruser
Hi somebody I hope this helps: df1-data.frame(cbind(va=runif(3), vb=runif(3))) df1 df2-data.frame(cbind(va=runif(3), vb=runif(3))) df2 df.blank-data.frame(cbind(va=NA, vb=NA)) df.blank df.join-rbind(df1, df.blank, df2) df.join Miltinho astronauta brazil On 7/25/08, [EMAIL PROTECTED]

Re: [R] response surface analysis

2008-07-26 Thread milton ruser
Hi Jimsong, If I understood your point, give a look at adehabitat and grasp packages. Almost for adehabitat there are a demo for you see its functionality. Cheers, miltinho astronauta brazil On 7/26/08, Jinsong Zhao [EMAIL PROTECTED] wrote: Hi, Is there a package that could do response

[R] multiple separators in scan() functions

2008-07-30 Thread milton ruser
Dear all, Is there a way of I deal with more than one kind of separators when reading a asc file using scan() function? The separators could be :, \t and ;. Kind regards miltinho [[alternative HTML version deleted]] __ R-help@r-project.org

[R] Modeling presence only data in R

2008-04-22 Thread milton ruser
Dear All, I have a set of environental maps and presence-only points for some species. How can I generate distributions models on R using these presence-only data? What packages and functions can I use to do so? Kind regards, Miltinho Brazil [[alternative HTML version deleted]]

Re: [R] Modeling presence only data in R

2008-04-22 Thread milton ruser
Hi Rubén, It also work for presence-only data? I haven´t absence data. Thanks a lot. miltinho On 4/22/08, Rubén Roa-Ureta [EMAIL PROTECTED] wrote: milton ruser wrote: Dear All, I have a set of environental maps and presence-only points for some species. How can I generate

Re: [R] Modeling presence only data in R

2008-04-23 Thread milton ruser
Dear Alejandro, Thank you very much for your advice. In fact I use GARP and Openmodeller, and they - up to I know - also generate pseudo-absence when modelling. I am searching some R solution to compare the results with OpenModeller outputs. Could you send-me a PDF (or the complete reference) of

[R] three-dimensional (volumetric) estimation from x,y,z points

2008-05-18 Thread milton ruser
Dear all, I have a set of x,y,z points obtained from a lizard species and now I would like to estimate the three-dimensional use of space for this species. I know that 2D area I can estimate using adehabitat packages, but I don´t know how to estimate the volumetric space. Any help are welcome.

[R] three-dimensional (volumetric) estimation from x,y,z points

2008-05-19 Thread milton ruser
Hi people, sorry for this reposting. I sent it yesterday to the list, but as I don´t received a copy I suppose that occourred some problem. Kind regards, miltinho -- Forwarded message -- From: milton ruser [EMAIL PROTECTED] Date: May 18, 2008 10:35 PM Subject: three-dimensional

[R] how to compute explained variance in metaMDS(vegan)?

2008-05-22 Thread milton ruser
Dear all, I used metaMDS (vegan) to generate two NMDS axis and now I would like to know the amount of variance explained for each axis. Is there a way to do that? kind regards, miltinho [[alternative HTML version deleted]] __

Re: [R] URGENTE

2009-04-30 Thread milton ruser
Hi Barbara, How about you copy-and-past the data into the notepad.exe editor and df-read.table (..., head=T, sep=\t) ? ciao miltinho brazil-toronto 2009/4/30 barbara.r...@uniroma1.it Sto imparando ora ad utilizzare R. Ho un problema: devo caricare i dati da un file xls creato da me,

Re: [R] question on aggregate

2009-05-01 Thread milton ruser
Mark, Give a look: rres-read.table(stdin(), head=T, sep=,) ID,Traversed, v2 1,5,1 1,7,1 1,8,1 2,8,2 2,11,2 2,7,2 3,11,3 3,22,3 3,16,3 aggregate(rres[c(Traversed, v2)], list(rres$ID), sum) bests milton On Fri, May 1, 2009 at 5:07 PM, Altaweel, Mark R. maltaw...@anl.gov wrote: Hi, I am

Re: [R] subset data

2009-05-05 Thread milton ruser
Like this? data-read.table(stdin(), head=T, sep=,) id,x 1,0.3604464 2,0.4813987 3,0.0160058 4,0.7165909 5,0.6092248 6,0.2413049 7,0.7981568 8,0.6093960 9,0.2887064 10,0.3485780 selected.id - sample(data$id,3,replace=F) selected.id data.subset-subset(data, id %in% selected.id) data.subset

Re: [R] subset data

2009-05-05 Thread milton ruser
just a small adjusts... data[data$id %in% selected.id, ] --- so elegant! :-) On Wed, May 6, 2009 at 1:15 AM, milton ruser milton.ru...@gmail.com wrote: Like this? data-read.table(stdin(), head=T, sep=,) id,x 1,0.3604464 2,0.4813987 3,0.0160058 4,0.7165909 5,0.6092248 6,0.2413049

Re: [R] Do you use R for data manipulation?

2009-05-05 Thread milton ruser
I also put my 2cents on sqldf :-) milton On Wed, May 6, 2009 at 12:30 AM, Wensui Liu liuwen...@gmail.com wrote: take a look at sqldf package(http://code.google.com/p/sqldf/), you will be amazed. On Wed, May 6, 2009 at 12:22 AM, Farrel Buchinsky fjb...@gmail.com wrote: Is R an appropriate

[R] clump of binary pixels on raster

2009-05-09 Thread milton ruser
Dear all, I have a set od 30,000 binary landscapes, which represent habitat and non-habitat cover. I need to generate images that identify those neighbour (rule 8) pixels as one patch ID, and a different patch ID for each clump of pixels. I coded it using labcon(adehabitat), but as some of my

Re: [R] automated polynomial regression

2009-05-14 Thread milton ruser
Also coef(mylm) where you can deal with coef(mylm) [1], coef(mylm)[2]... And plot(y~x, data=mydf) curve(coef(mylm)[1]+coef(mylm)[2]*x) could produce interesiting visual results :-) milton On Thu, May 14, 2009 at 2:30 PM, Dieter Wirz didi.w...@gmail.com wrote: Thanks Bert and Luc!

Re: [R] Problems with sample variance

2009-05-20 Thread milton ruser
Hi Chloe, Try this: NUMBER.OF.RUNS-10 #change here for (NR in 1:NUMBER.OF.RUNS) { number.simulation-1000 sample.size=15; variance.list-NULL for(i in 1:number.simulation) { mysample-rnorm(sample.size) variance.list- c(variance.list, var(mysample)) } #i hist(variance.list) } #NR

Re: [R] Re order variables in a dataframe

2009-05-20 Thread milton ruser
Following Simon's example dat - data.frame(d=rnorm(3), c=rnorm(3), b=rnorm(3), a=rnorm(3)) dat dat-subset(dat, select=c(d,a,b,c)) dat Bests milton brazil=toronto On Thu, May 21, 2009 at 12:02 AM, Simon Blomberg s.blombe...@uq.edu.auwrote: How about to insert a variable a2 inbetween the first

Re: [R] Problems with sample variance

2009-05-21 Thread milton ruser
PM To: milton ruser; Chloe Smith Cc: r-help@r-project.org Subject: Re: [R] Problems with sample variance Thanks Milton - I misread Chloe's original question. nSims - 1000 sampSiz - 15 myVars - tapply(rnorm(nSims*sampSiz), rep(1:nSims, sampSiz), var) This is a little more

Re: [R] how to implement a circular buffer with R

2009-05-24 Thread milton ruser
Hi Maura, It is not elegant but may work. actual.string- 12345abcdefgh12345abcdefgh actual.string actual.string-paste(substr(actual.string, nchar(actual.string),nchar(actual.string)), substr(actual.string, 1,nchar(actual.string)-1), sep=) actual.string #in a looping actual.string-

Re: [R] Plotting two regression lines on one graph

2009-06-07 Thread milton ruser
Hi Jo, Next time try prepare a reproducible code. You have several ways of do that (see Dylan Beaudette) and give a look below. x-1:100 y-7+x*(sqrt(x*runif(100))) plot(y~x) mod1-glm(y~x) mod2-glm(y~x+I(x*x)) curve(mod1$coef[1]+mod1$coef[2]*x, col=red, add=T, lwd=3)

Re: [R] mean

2009-06-08 Thread milton ruser
Hi Amor, I think you forgot to include the individual ID. ?aggregate cheers milton brazil=toronto On Mon, Jun 8, 2009 at 8:11 AM, amor Gandhi amorigan...@yahoo.de wrote: Hi, I have gote the following data x1 - c(rep(1,6),rep(4,7),rep(6,10)) x2 - rnorm(length(x1),6,1) data -

Re: [R] mean

2009-06-08 Thread milton ruser
oops. If x1 is the individual try x2.mean-aggregate(data[2:2], list(x1), mean) x2.mean you can change mean by any function. cheers milton On Mon, Jun 8, 2009 at 8:20 AM, milton ruser milton.ru...@gmail.com wrote: Hi Amor, I think you forgot to include the individual ID. ?aggregate

Re: [R] caret package

2009-06-08 Thread milton ruser
Hi Sonny Vic, how about you send a reproducible code? cheers milton On Mon, Jun 8, 2009 at 11:25 AM, sunny vic vss.0...@gmail.com wrote: Hi all I am using the caret package and having difficulty in obtaining the results using regression, I used the glmnet to model and trying to get the

Re: [R] caret package

2009-06-08 Thread milton ruser
cheers vss On Mon, Jun 8, 2009 at 10:42 AM, milton ruser milton.ru...@gmail.comwrote: Hi Sonny Vic, how about you send a reproducible code? cheers milton On Mon, Jun 8, 2009 at 11:25 AM, sunny vic vss.0...@gmail.com wrote: Hi all I am using the caret package and having difficulty

[R] spatstat: changing r limits when plot envelope

2009-06-08 Thread milton ruser
Dear all, I need to change the default of r when plotting the output of the envelope function of spatstat package. I can do this manually for the Lest output: ## Example from spatstat Kest help data(cells) L - Lest(cells, correction=isotropic, r=seq(from=0,to=0.5, by=0.05)) x11(1000,400)

Re: [R] Vista + R = *!!?@

2009-06-10 Thread milton ruser
Hi there, I have run R on vista using glm(), mle, mle2 (bbmle), spatstats without problem. cheers milton On Wed, Jun 10, 2009 at 5:33 PM, Marc Schwartz marc_schwa...@me.com wrote: On Jun 10, 2009, at 1:57 PM, John Townsend-Mehler wrote: Hello People of R, Is there any way that I can get

<    1   2   3   >