Re: [R] linux gplots install unhappy
Thanks to the many folks who responded, and apologies for being so dense! The different behavior between windows and linux relative to install defaults tripped me up. I had not thought about the dependencies switch. All working fine now. Cheers, =Randy= R. Zelick email: [EMAIL PROTECTED] Department of Biology voice: 503-725-3086 Portland State University fax: 503-725-3888 mailing: P.O. Box 751 Portland, OR 97207 shipping: 1719 SW 10th Ave, Room 246 Portland, OR 97201 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] linux gplots install unhappy
Hello all, I use R on both windows and a mainframe linux installation (RedHat enterprise 3.0, which they tell me is soon to be upgraded to 4.0). On windows I installed the package gplots without trouble, and it works fine. When I attempted to do the same on the unix computer, the following error message was forthcoming: downloaded 216Kb * Installing *source* package 'gplots' ... ** R ** data ** inst ** preparing package for lazy loading Loading required package: gtools Warning in library(pkg, character.only = TRUE, logical = TRUE, lib.loc = lib.loc) : there is no package called 'gtools' Error: package 'gtools' could not be loaded Execution halted ERROR: lazy loading failed for package 'gplots' ** Removing '/n/fs/disk/resuser02/u/zelickr/R/library/gplots' The downloaded packages are in /tmp/RtmpikM2JW/downloaded_packages Warning messages: 1: installation of package 'gplots' had non-zero exit status in: install.packages(gplots, lib = ~/R/library) 2: cannot create HTML package index in: tools:::unix.packages.html(.Library) Can someone provide the bit of information I need to progress with this? Thanks very much, =Randy= R. Zelick email: [EMAIL PROTECTED] Department of Biology voice: 503-725-3086 Portland State University fax: 503-725-3888 mailing: P.O. Box 751 Portland, OR 97207 shipping: 1719 SW 10th Ave, Room 246 Portland, OR 97201 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] fit sine?
Hello list, I am making scatterplots of data that vary sinusoidally over 24 hours. With a bit of previous help from this list, I now can get an x-axis with time tics from 00:00 on the left edge to 12:00 in the middle and 00:00 on the right edge, i.e., just 24 hours. Now I would like to fit a sin function to the plot. I've looked all over CRAN and the web in general, but have not found a method or package for this. Can anyone make a suggestion? Thanks, =Randy= Using R 2.4.0 on Solaris (unix). R. Zelick email: [EMAIL PROTECTED] Department of Biology voice: 503-725-3086 Portland State University fax: 503-725-3888 mailing: P.O. Box 751 Portland, OR 97207 shipping: 1719 SW 10th Ave, Room 246 Portland, OR 97201 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] samples to dataframes
Hello all, I'll bet this is not complicated, but I really did hunt for information on it, and tried some ideas without success. Running Windows XP and R 2.3.1 I am using the Sound package to read in .wav files, and this works fine. The R object produced is of class sample. I want to use some of the functions in the package Seewave to do further analysis, but this package wants data objects to be dataframes. So I tried various ways to coerce samples to dataframes, but was not successful. Does anyone have a hint/solution? Thanks much, =Randy= -- Randy Zelickemail: [EMAIL PROTECTED] Department of Biology voice: 503-725-3086 Portland State University fax: 503-725-3888 mailing: P.O. Box 751 Portland, OR 97207 shipping: 1719 SW 10th Ave, Room 246 Portland, OR 97201 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] file.choose but for folder/directory?
Hello there, This question is relative to WindowsXP, using R 2.2.1: I am looking for a function that allows a user to interactively choose a directory so I can use list.files to process all the files in that directory. I've looked at getwd, but this is not interactive. The functions file.choose and choose.files are the right idea, but these only permit selection of a file within a folder, not the folder itself. Thanks for any and all suggestions, =Randy= R. Zelick email: [EMAIL PROTECTED] Department of Biology voice: 503-725-3086 Portland State University fax: 503-725-3888 mailing: P.O. Box 751 Portland, OR 97207 shipping: 1719 SW 10th Ave, Room 246 Portland, OR 97201 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] file.choose but for folder/directory -- THANKS!
Thanks to all who responded. I upgraded to 2.3.1 straight away, and choose.dir does exactly what I need. Cheers, =Randy= R. Zelick email: [EMAIL PROTECTED] Department of Biology voice: 503-725-3086 Portland State University fax: 503-725-3888 mailing: P.O. Box 751 Portland, OR 97207 shipping: 1719 SW 10th Ave, Room 246 Portland, OR 97201 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] x y averaging thanks
I have three completely different(!) but workable solutions. Thanks much for your help. =Randy= R. Zelick email: [EMAIL PROTECTED] Department of Biology voice: 503-725-3086 Portland State University fax: 503-725-3888 mailing: P.O. Box 751 Portland, OR 97207 shipping: 1719 SW 10th Ave, Room 246 Portland, OR 97201 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] x y averaging
Hello, I am trying to average a number of data sets where the x vector contains times and the Y data are instrument readings. The vectors all have different numbers of values, but many X time values match. For example: A fragment of the first data set: x vectvalue 14:56:10 0.325 14:62:11 0.111 14:68:11 0.214 . . . this can go on for 100's of values, spaced by 6 minutes, but there can be gaps too, like: 16:05:18 0.245 16:11:09 0.266 16:17:05 0.271 16:33:00 0.304 16:39:05 0.300 A fragment of the second data set: 15:59:08 0.255 16:05:44 0.281 16:11:25 0.249 16:17:39 0.238 16:23:51 0.288 ...and the result I am looking for is a new vector that looks like this: 14:56:10 0.325 14:62:11 0.111 14:68:11 0.214 . . . 15:59:08 0.255 16:05:18 0.2630 * matches, so average 16:11:09 0.2575 * matches, so average 16:17:05 0.2545 * matches, so average 16:33:00 0.304 16:39:05 0.300 The times values in the new X vector are properly interleaved taking data across the datasets, but when there is a match the Y values are averaged. Note that the seconds don't matter. I am using R Version 2.2.1 on a PC Thanks for thinking about it, =Randy= R. Zelick email: [EMAIL PROTECTED] Department of Biology voice: 503-725-3086 Portland State University fax: 503-725-3888 mailing: P.O. Box 751 Portland, OR 97207 shipping: 1719 SW 10th Ave, Room 246 Portland, OR 97201 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] trouble with plotrix package
Hello list, I wrote a simple program to plot data on polar axes, taking advantage of the plotrix package and its function radial.plot. The basic plot works fine, but I am having difficulties with the formatting. There are three problems, but I thought I would attack them one at a time. Here is the first: If my data set contains values with all vector lengths between 0 and 100 (and various angles), and I set rp.type=s, I get a nice bullseye type plot with the data shown on a background of concentric circles labeled appropriately. On the other hand, if my data only contain vector length values from, say, 80 to 90 then the first concentric ring is at 80, and five more rings are scrunched between 80 and 100. It looks like there is an autoscaling feature turned on that says make a fixed number of rings starting at a nice value below the user's lowest data value and extending to a nice value above. There is a switch to set the upper bound on rings (radial.lim) but I don't see a way to specify the lower bound. What I want is a bullseye plot that goes from my start value (first ring at 10) to my end value (last ring at 100) independent of the data range. Thanks!! =Randy= R. Zelick email: [EMAIL PROTECTED] Department of Biology voice: 503-725-3086 Portland State University fax: 503-725-3888 mailing: P.O. Box 751 Portland, OR 97207 shipping: 1719 SW 10th Ave, Room 246 Portland, OR 97201 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] extract a row
Hello there, Using 1.9.0 on WinXP... I have a data frame, one column of which is named rate. The column has text entries like fast, medium, slow, very slow, and so forth. I have not tried to make them factors, but maybe R did this automatically. Anyway, I would like to display on the console rows that meet a rate criterion. So I want to type something like: dataframe[rate==slow] and get back this sort of output: test subject trial rate score 34B27 3 slow 27 55B55 4 slow 34 where test, subject, trial, rate, and score are all the dataframe's columns. How do I do that?? Thanks, =Randy= R. Zelick email: [EMAIL PROTECTED] Department of Biology voice: 503-725-3086 Portland State University fax: 503-725-3888 mailing: P.O. Box 751 Portland, OR 97207 shipping: 1719 SW 10th Ave, Room 246 Portland, OR 97201 __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] swapping with data.frame
Hi there, I have some data which are convenient to enter as lists. For example: t1-list(fname=animal1,testname=hyla,dspkr=left,res1=39.7,res2=15.0) t2-list(fname=animal1,testname=bufo,dspkr=left,res1=14.4,res2=56.1) t3-list(fname=animal2,testname=hyla,dspkr=right,res1=22.6,res2=11.8) I would like to generate a dataframe, but *not* the way this approach works... fdf-data.frame(t1,t2,t3) fdf fname testname dspkr res1 res2 fname testname dspkr res1 res2 ... 1 animal1 hyla left 39.7 15 animal1 bufo left 14.4 56.1 ... Instead, what I would like is: fname testname dspkr res1res2 t1 animal1 hylaleft 39.715.0 t2 animal1 bufoleft 14.456.1 t3 animal2 hyla right 22.611.8 or this would be fine too... x fname testname dspkr res1res2 1 t1 animal1 hylaleft 39.715.0 2 t2 animal1 bufoleft 14.456.1 3 t3 animal2 hyla right 22.611.8 Is there a practical (hopefully simple) way to do this? Thanks, =Randy= R. Zelick email: [EMAIL PROTECTED] Department of Biology voice: 503-725-3086 Portland State University fax: 503-725-3888 mailing: P.O. Box 751 Portland, OR 97207 shipping: 1719 SW 10th Ave, Room 246 Portland, OR 97201 __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] formatted table to disk
Hello there, Using R 1.8.1 and WinXP... I would like to write a disk file (ascii text) of an R data frame. When I type the name of the object in the console window, it is sensibly and nicely formatted. When I use write.table, it is *not*, because the separation character is just a space. I looked through the introductory material (my level) on the R website, but did not find a reference to this issue. At a minimum I suppose there is a way to insert a tab character in the sep= field, but I don't know how to do that. Alternatively, I could deal with a variable specifying fixed-field widths for each of the variables in the frame. Didn't find that either. Even so, you would loose the right-justification and the fact that R seems to take into account the width of the largest value in a column. Of course the really slick deal would be to have paginated output where the column titles repeat at the top of the page (having entered a parameter for the number of lines on your page after margins and so forth). A somewhat brutal solution would be to create all the text strings for making a LaTex document/table environment and write all that stuff out to the text file. Please don't tell me I have to do that! So is there a function for producing a file on disk with the same formatting as the screen? Thanks, =Randy= R. Zelick email: [EMAIL PROTECTED] Department of Biology voice: 503-725-3086 Portland State University fax: 503-725-3888 mailing: P.O. Box 751 Portland, OR 97207 shipping: 1719 SW 10th Ave, Room 246 Portland, OR 97201 __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] formatted table to disk
Hello, Thanks for the help, all who made suggestions. Sink worked -- I don't know why I can't find these things. I'll look at the xtable package as suggested also. =Randy= R. Zelick email: [EMAIL PROTECTED] Department of Biology voice: 503-725-3086 Portland State University fax: 503-725-3888 mailing: P.O. Box 751 Portland, OR 97207 shipping: 1719 SW 10th Ave, Room 246 Portland, OR 97201 __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] histogram y-scaling
Hello all, Relative to WinXP R1.8 I have two histograms to plot, and for comparison purposes I want them to have the same Y-scaling. I tried to find the size of the bin with the maximum count before generating the histogram, but this did not work (see below). What is a better way? par(mfrow=c(2,1)) # set up for plotting in 2 rows and 1 column x1-seq(-0.5,58.5,1) # make a range of x values for histogram I thought the following lines would allow me to capture the results of the hist function and determine the max bin count for scaling *before* making the plot, but R cleverly saw around my method and plots it anyway. With this code I get two plots. q=hist(mt1,x1) # stick results in a variable... alas also plots cts=q$counts # get the bin counts mct1=max(cts)# how many values in the bin with the most values hist(mt1,x1) # generate histogram plot # go on with histogram #2... Thanks, =Randy= R. Zelick email: [EMAIL PROTECTED] Department of Biology voice: 503-725-3086 Portland State University fax: 503-725-3888 mailing: P.O. Box 751 Portland, OR 97207 shipping: 1719 SW 10th Ave, Room 246 Portland, OR 97201 __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] basic programming question
Hello list, I am just starting to write some R functions (R 1.8 and Windows XP) and got stuck as described below: We have a bunch of time series data files, each is about 10,000 values. There is a 12-line header in each one. I can read them and plot them easily with R, but I want to make an automated system to read all the files in a folder and have them appear as R objects that I can assemble in different plots, or analyze together. Perhaps this would be best done reading into a data table, where each row is one of the files and each row extends for 10,000 columns? Or perhaps as a matrix? I could use advice on that. My first notion, though, was just to have them be individual files. I started as follows: # # build a path from its parts: # p1=C: p2=Work-PSU p3=Lab-People-and-Projects p4=Dane p5=2004-04-06 pt=file.path(p1,p2,p3,p4,p5,fsep=/) # lf-list.files(pt) ff=files sayfiles=paste(length(lf),ff,sep= ) # # at this point if I type sayfiles I get 30 files printed at the console. OK, this is progress. # # Now I want to cycle through all the files and read in each one. The # code here almost works, but I don't know how to do in R the simple task # of substituting the read file name as the data object name. # d=dir(pt) for (i in d){d[i]=scan(paste(pt,i,sep=/),skip=12)} # this almost works # I know this is wrong, I just want to show my intention -- that is on each iteration of the loop have a new R object made called d[i], the name of the current file. This new object is then the result of the scan operation on the file of that same name. Thanks, =Randy= R. Zelick email: [EMAIL PROTECTED] Department of Biology voice: 503-725-3086 Portland State University fax: 503-725-3888 mailing: P.O. Box 751 Portland, OR 97207 shipping: 1719 SW 10th Ave, Room 246 Portland, OR 97201 R. Zelick email: [EMAIL PROTECTED] Department of Biology voice: 503-725-3086 Portland State University fax: 503-725-3888 mailing: P.O. Box 751 Portland, OR 97207 shipping: 1719 SW 10th Ave, Room 246 Portland, OR 97201 __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Re: [R-gui] Editor in R
Hello there, I have been using WinEdt as a text editor for a while. I use it in a simple general purpose way, and take advantage of just a few of the 100's (1000s?) of features. I would say that used this way it is certainly not more difficult than R. So it would seem that if you are successful teaching R to biologists, additionally learning WinEdt should not push anyone over the edge. Still, another alternative is Pico, which you can get for free for Windoze. By the way, although Notepad works for R scripts, when I tried Wordpad it did not. Probably puts whacko crapola at the end of each line. Cheers, =Randy= R. Zelick email: [EMAIL PROTECTED] Department of Biology voice: 503-725-3086 Portland State University fax: 503-725-3888 mailing: P.O. Box 751 Portland, OR 97207 shipping: 1719 SW 10th Ave, Room 246 Portland, OR 97201 __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] x-only zoom and pan?
Hello list, Could the following be done without too much grief...? Lets say I have two or three time series objects that I want to inspect visually. Each I would plot with a y-offset so they stack up. They share the same X scaling. The problem is that each is perhaps 100K values. Due to the large number of values, features of the data sets cannot be seen when all values are plotted. What would be nice is to plot a fraction of the X range (say 10%). This would be equivalent to zooming in the X direction. Then using a key (ideally an arrow key), shift the viewing frame right or left to effectively scroll through the data. So first you view 0-10%, then 10-20% and so forth. If necessary I can fabricate a vector with X values in it and plot(x,y) instead of as time series, if this makes it any easier. I am using a Windows version of R. Thanks, =Randy= R. Zelick email: [EMAIL PROTECTED] Department of Biology voice: 503-725-3086 Portland State University fax: 503-725-3888 mailing: P.O. Box 751 Portland, OR 97207 shipping: 1719 SW 10th Ave, Room 246 Portland, OR 97201 __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] data frame output almost
Hello again, I got three responses for help on the leading zero problem. Thank you. Alas I still don't have it working. Here are more specifics: I read in a data file like this: participants-read.table(C:/Work/blah-blah) The data file consists of the fields last name, first name, social security number, response score 1, response score 2 and so forth. If in the console window I type participants I get something like: Jones Norman 786123344 98.2 16.3 FlintstoneFred 111457654 10.1 8.8 UglyButt 89733456 66.7 32.0 The problem is that the 3rd social security number is really 089733456 and it needs to look like that. None of the methods suggested seemed to work. I could make the social security object alone print with leading zeros, but not as part of the data frame. Thanks again, =Randy= R. Zelick email: [EMAIL PROTECTED] Department of Biology voice: 503-725-3086 Portland State University fax: 503-725-3888 mailing: P.O. Box 751 Portland, OR 97207 shipping: 1719 SW 10th Ave, Room 246 Portland, OR 97201 __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] data frame output
Hello list, Is there a way to *not* supress leading zeros when printing (to the console window or to a file) a dataframe? Thanks, =Randy= R. Zelick email: [EMAIL PROTECTED] Department of Biology voice: 503-725-3086 Portland State University fax: 503-725-3888 mailing: P.O. Box 751 Portland, OR 97207 shipping: 1719 SW 10th Ave, Room 246 Portland, OR 97201 __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html