FAQ

R>r-help>May 2008

802 discussions - 2,512 posts

• 36

[R] Pros and Cons of R

Hi, I am doing a very informal presentation for my office about R capabilities to deal with and analyze spatial data, display data and maps, and connections with GIS. I've used in my presentation ...
 Monica PisicaMay 22, 2008 at 4:00 pmMay 28, 2008 at 11:32 am
• 27

Hi everyone, I am confused on how to specify some nesting and interaction terma with lme(). I have a dataset where some flies where selected for accessory gland size, made to mate in presence/absence ...
 Federico CalboliMay 8, 2008 at 4:32 pmMay 16, 2008 at 4:28 am
• 20

[R] Solving 100th order equation

Hi R, I have a 100th order equation for which I need to solve the value for x. Is there a package to do this? For example my equation is: (x^100 )- (2*x^99) +(10*x^50)+.............. +(6*x ) = 4000 I ...
 Shubha Vishwanath KaranthMay 24, 2008 at 11:16 amMay 26, 2008 at 7:29 am
• 17

[R] Inconsistent linear model calculations

Readers, Using version 251 I tried the following command: lm(y~a+b,data=datafile) Resulting in, inter alia: ... coefficients (intercept) a 1.2 3.4 Packages installed: acepack ace() and avas() for ...
 E-letterMay 15, 2008 at 12:05 pmMay 16, 2008 at 12:58 pm
• 14

[R] function in nls argument

Greetings R users, maybe there is someone who can help me with this problem: I define a function "optim.fun" and want as output the sum of squared errors between predicted and measured values, as ...
 Fernando MoyanoMay 7, 2008 at 3:40 pmMay 20, 2008 at 10:39 am
• 13

[R] can I do this with R?

Hello, I am just about to install R and was wondering about a few things. I have only worked in Matlab because I wanted to do a logistic regression. However Matlab does not do logistic regression ...
 MariaMay 28, 2008 at 11:01 amMay 29, 2008 at 2:11 pm
• 12

[R] Random number generation

Colleagues, I have encountered behavior of random number generation that eludes me. I generate a random integer in a particular range using the following code: sample(1000:9999, size=1) This code ...
 Dennis FisherMay 10, 2008 at 5:55 pmMay 13, 2008 at 5:58 pm
• 11

[R] help with simple function

I have a matrix of frequency counts from 0-160. x<-as.matrix(c(0,1,0,0,1,0,0,0,1,0,0,0,0,1)) I would like to apply a function creating a new column (x[,2])containing values equal to: a) log(x[m,1]) ...
 T.D.RudolphMay 27, 2008 at 7:42 pmMay 30, 2008 at 5:50 am
• 11

[R] help with updating to R2.7

Hi, From R 2.6, I would like to update to R2.7. I would like to have some tips on the recommended method of installing the latest versions of an entire list of packages in R2.7 - i.e. all the ...
 RaviMay 7, 2008 at 4:51 pmMay 9, 2008 at 7:11 am
• 10

[R] Troubles plotting lrm output in Design Library

Dear R-helpers, I'm having a problem in using plot.design in Design Library. Tho following example code produce the error: Error in value.chk(at, ix, xseq, if (plot.type == "curves") 100 else 40, ...
 Patrizio FredericMay 29, 2008 at 10:53 amMay 31, 2008 at 4:15 am
• 10

[R] A Very Simple Question

scale(X, scaleúLSE) ?scale -- Chuck Cleland, Ph.D. NDRI, Inc. (www.ndri.org) 71 West 23rd Street, 8th floor New York, NY 10010 tel: (212) 845-4495 (Tu, Th) tel: (732) 512-0171 (M, W, F) fax: (917) ...
 Chuck ClelandMay 13, 2008 at 2:35 pmMay 15, 2008 at 8:38 am
• 10

[R] Column renaming

Dear all, Is there a less cumbersome way to rename a column by name (as opposed to index) than -- names( X)[ names[ X] == "bob"]<-"sue" ? A semi-related question: how does one get the index of a ...
 Chip BarnabyMay 5, 2008 at 2:48 pmMay 5, 2008 at 6:59 pm
• 9

[R] "rbinom" not using probability of success right

I am trying to simulate a series of ones and zeros (1 or 0) and I am using "rbinom" but realizing that the number of successes expected is not accurate. Any advice out there. This is the example ...
 Philip Twumasi-AnkrahMay 28, 2008 at 12:53 pmMay 29, 2008 at 4:26 pm
• 9

[R] how to bind lists recursively

Dear all, I want to create a list that contains 0,1,2,3, ..., 10000 as its elements. I used the following code, which apparently doesn't work very well. a <- 0 for(i in 1:10000) { a <- list(a, i) } ...
 Daniel YangMay 28, 2008 at 2:43 amMay 28, 2008 at 5:13 pm
• 9

[R] strip white in character strings

Dear all, I have several datasets and I want to generate pdf plots from them. I also want to generate automatically the names of the files. They are country-specific and the element ...
 Roland RauMay 14, 2008 at 4:06 pmMay 15, 2008 at 11:36 pm
• 9

[R] Format integer

Hi, What's one way to convert an integer to a string with preceding 0's? such that '13' becomes '00000000013' to be put into a string I've tried formatC, but they removes all the zeros and replace it ...
 Anh TranMay 12, 2008 at 9:22 pmMay 13, 2008 at 9:40 am
• 9

[R] categorical data analysis

hie all i am trying to carry out a categorical data analysis but my problem is that when in i use the chi squared test some of my expected values are less than 5. is there a test that can handle this ...
 Raymond chirukaMay 6, 2008 at 4:34 pmMay 8, 2008 at 3:00 am
• 8

[R] For Social Network Analysis-Graph Analysis - How to convert 2 mode data to 1 mode data?

Hi, Does anyone know of a package in R that has a function to convert network data (e.g. an adjacency matrix or ) from 2-mode to 1-mode? I am conducting social network analysis. I know that Pajek has ...
 Messing, Solomon O.May 9, 2008 at 7:37 pmJun 4, 2009 at 6:28 pm
• 8

[R] Select certain elements from dataframe

Hello, I have a specific problem, I have a large dataframe, and after clustering I want to select certain colums, the elements of a subcluster. My dataframe looks like this : [1] "101KF4319097339" ...
 SebastianEckMay 19, 2008 at 9:20 amMay 20, 2008 at 11:54 am
• 8

[R] interactive rotatable 3d scatterplot

I would like to create a 3d scatterplot that is interactive in the sense that I can spin it on its axes to better visualize some PCA results I have. What are the options in R? I've looked at RGL and ...
 Mark KimpelMay 3, 2008 at 12:08 amMay 19, 2008 at 8:51 pm
• 8

[R] subset rows in two dataframes

Dear list: I have two dataframes, say dat1 and dat2. Each has several variables but 3 of each are common in both, (say v1, v2 and v3). v1 and v2 are factores while v3 is numeric. Now, I need a subset ...
 PartofyMay 10, 2008 at 10:31 pmMay 11, 2008 at 4:39 pm
• 8

[R] Is there in R a function equivalent to the mround, as found in most spreadsheets?

Dear R-users, I have the following problem In a lab experiment I have to mix three solutions to get different concentrations of various molecules in a cuvette I've used R to calculate the necessary ...
 Dr. Ottorino-Luca PantaniMay 6, 2008 at 4:07 pmMay 11, 2008 at 9:42 am
• 7

[R] Box.test degrees of freedom

Dear colleagues, I am new to R and statistics so please keep that in mind. I have doubts on the df calculation of Ljung-Box test (Box.test). The function seems to use always the df=lag=m and not ...
 Nuno PristaMay 16, 2008 at 3:45 pmAug 11, 2008 at 2:15 pm
• 7

[R] How do you exit a function in R?

For example, based on a certain condition, I may want to exit my code early: # Are there the same number of assets in "prices" and "positions"? if (nAssetPositions != nAssetPrices) { cat("Different ...
 Bill CunliffeMay 29, 2008 at 6:23 pmMay 29, 2008 at 6:48 pm
• 7

[R] How to make R running faster

Hi everyone, I run the R loops on window XP and vista. Both are Intel core 2 Duo 2.2 GHz with 2 GB ram and XP is significantly faster than vista. Dose anyone know how speed up R loops in vista? Thank ...
 CtuMay 28, 2008 at 8:26 amMay 28, 2008 at 11:05 pm
• 7

[R] need help for building R in Ubuntu 8.04

Hi everyone I have been trying to build R in ubuntu 8.04 from its source code but am getting the following error. configure: error: --with-x=yes (default) and X11 headers/libs are not available ...
 Nitesh AgrawalMay 25, 2008 at 6:12 pmMay 28, 2008 at 4:18 pm
• 7

[R] (no subject)

hi all, i wanted to use the sink function to sequentially output regression summaries within a for-loop. i must have something wrong somewhere (or be using the sink function incorrectly), but can ...
 Tony DellMay 1, 2008 at 2:29 amMay 27, 2008 at 10:12 am
• 7

[R] 3D Area Diagram

Hello, maybe someone can help me. I am looking for a possibility to plot a 3D area diagram like in Excel: http://www.microsoft.com/germany/mac/excel/images/chartbefore.jpg Watch this! Would be nice ...
 AlGatesMay 22, 2008 at 7:04 pmMay 23, 2008 at 6:53 pm
• 7

Hi all, I tried to follow an online tutorial to run openBUgs but the package BRugs has been removed from R repository. Could someone provide a link for where to download BRugs? Thanks a lot! -- View ...
 QqwMay 22, 2008 at 7:09 pmMay 23, 2008 at 6:42 am
• 7

[R] Alignment of axes intersection

All, Very basic question I can't seem to find the answer to: plot(0:10, 0:10) The axes intersection is not aligned at (0,0) in the lower left. How does one force this? I searched for graphical ...
 David AfshartousMay 20, 2008 at 3:49 pmMay 20, 2008 at 7:37 pm
• 7

[R] recoding data with loops

# I'm new to R and am trying to get the hang of how it handles # dataframes & loops. If anyone can help me with some simple tasks, # I'd be much obliged. # First, i'd like to generate some random ...
 Donald BramanMay 19, 2008 at 7:41 pmMay 20, 2008 at 12:34 am
• 7

[R] Font settings in xfig

Hello I'm using the xfig-function in R to export figures in fig-format. To use these exported figures in LaTeX, I first run a fig2dev to get a pstex and pstex_t file. However, in order to get the ...
 RobertMay 15, 2008 at 10:12 amMay 19, 2008 at 2:20 pm
• 7

[R] reading and analyzing a text file

Dear list, I have a text file from a scanner that includes 20 lines of text (scanner settings) before it actually starts showing the readings in a tabular format (headings are ID, intensity, ...
 DAVID ARTETA GARCIAMay 16, 2008 at 2:30 pmMay 18, 2008 at 12:58 pm
• 7

[R] Integer / floating point question

Dear R-help - I have thought about this question for a bit, and come up with no satisfactory answer. Say I have the numeric vector t1, given as t1 <- c(1.0, 1.5, 2.0, 2.5, 3.0) I simply want to ...
 Erik IversonMay 16, 2008 at 2:56 pmMay 16, 2008 at 8:03 pm
• 7

[R] Split a string of oneline into 2 lines.

Hi, I am trying to split a string into 2 separate strings in 2 lines. So, tried with sprintf("%s \n %s", "ID", "Name") But R prints: [1] "ID \n Name" instead of ID Name Is it something I am missing ...
 A EzhilMay 14, 2008 at 3:37 pmMay 15, 2008 at 8:54 am
• 7

[R] How can one make stepAIC and lme

Dear R-help I'm working on a large dataset which I have divided into 20 subsets based on similar features. Each subset consists of observations from different locations and I wish to use the location ...
 Jorunn SlagstadMay 9, 2008 at 12:04 pmMay 14, 2008 at 1:05 pm
• 7

[R] R benchmarking program

Hi All, I've just rebuild the latest R with the Goto BLAS on our new Intel quad core machines. I did a few basic matrix calculations, and I was very impressed by the performance I saw. I wonder if ...
 Baker D.J.May 13, 2008 at 11:33 amMay 14, 2008 at 11:10 am
• 7

[R] how to not sort factors when plotting

Hello, When making a graph, plot and boxplot automatically sort my factor levels (y axis) into alphabetical order. Is there a way to make it NOT do this? I've tried: sort.by="none", sortedúLSE, ...
 Lydia N. SlobodianMay 1, 2008 at 1:31 pmMay 12, 2008 at 4:54 pm
• 7

[R] Error while making R package

Hi All, I am trying to make R package using R 2.6.2 And I am getting following error. When I give R CMD check t1\ ---------- Making package t1 ------------ adding build stamp to DESCRIPTION making ...
 Vidhu ChoudharyMay 1, 2008 at 8:20 pmMay 10, 2008 at 9:01 pm
• 7

[R] MLE for noncentral t distribution

I have a data with 236 observations. After plotting the histogram, I found that it looks like non-central t distribution. I would like to get MLE for mu and df. I found an example to find MLE for ...
 KateMay 8, 2008 at 2:34 pmMay 9, 2008 at 2:32 pm
• 7

[R] help with the unique function

Hi, The unique function is easy to understand and use. Beyond that, I want to get also the frequency of repetition of each individual row in a data frame Let me explain with an example ...
 RaviMay 7, 2008 at 4:11 pmMay 8, 2008 at 6:37 pm
• 6

[R] loess plot

I was trying to plot some data in R. I used the following code to draw a loess fit and got the output as Error in lowess(log(abs(t(res))), log(abs(t(synthesised)))) :?? NA/NaN/Inf in foreign function ...
 ShetumiMay 30, 2008 at 2:32 pmJul 18, 2008 at 2:59 am
• 6

[R] Alternatives to rJava and JRI

Has anyone come across any alternatives to rJava and JRI? Are they any good? Better perhaps? Please give your reasons. Thanks, Danish - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ...
 Munir, DanishMay 22, 2008 at 7:50 pmJun 12, 2008 at 10:09 pm
• 6

[R] Unicode characters (R 2.7.0 on Windows XP SP3 and Hardy Heron)

Hi all Four questions regarding Unicode. Three Windows questions. I am using - a PC with Windows XP (Build 20600.xpsp080413-2111 (Service Pack 3); - the following R version: platform i386-pc-mingw32 ...
 Stefan Th. GriesMay 30, 2008 at 3:14 pmJun 1, 2008 at 7:50 pm
• 6

[R] lm() function

hi, my linear model is y=c+a*x1+b*x2 i tried to found a, c, b by the use of: mymodel<-lm(y~1+x1+x2) where y, x1, x2 are 3 vectors with the same length the result is a=NA.so i want to know where is ...
 HanenMay 29, 2008 at 9:15 pmMay 30, 2008 at 4:14 am
• 6

[R] Computing P-Value

Hi, Is there an R function or package that computes p-value? -GV
 Edward WijayaMay 28, 2008 at 10:23 amMay 29, 2008 at 6:57 am
• 6

[R] package functions documentation

Dear all, I am currently creating a package and writing the documention files for some functions (the main functions). When using R CMD check myPackage, I get a warning message indicating that some ...
 Ardia DavidMay 27, 2008 at 1:30 pmMay 28, 2008 at 11:39 am
• 6

[R] RcppTemplate find example C++ souce code without Rtools ??

Dear R users, I would like to call R from C++ and Rcpp class library already compiled are a big advantage !! I have already read the doc/PDF in the installed package 5.0 and all the posts in this ...
 Roberto IacopettiMay 26, 2008 at 2:08 pmMay 27, 2008 at 3:29 pm
• 6

[R] Boxplot width

Hi there, assume that you have data with different sampling like d1 <- rnorm(100) d2 <- rnorm(150) now, I'd like to create two boxplots in one graph but each plot located at the sampling number at ...
 AntjeMay 23, 2008 at 3:52 pmMay 26, 2008 at 9:27 am
• 6

[R] Configuring emacs/ess on Ubuntu

Hi all, I don't know if this is the proper place to ask this, but I am trying to configure emacs/ess on Ubuntu 8.04 to run the way described for ESS and Xemacs in Windows (John Fox's guide). I ...
 Wade WallMay 25, 2008 at 2:07 pmMay 25, 2008 at 4:09 pm