FAQ

# R>r-help>April 2012

## 835 discussions - 2,949 posts

• 36

#### [R] Solve an ordinary or generalized eigenvalue problem in R?

Folks: I'm trying to port some code from python over to R, and I'm running into a wall finding R code that can solve a generalized eigenvalue problem following this function model ...
 Jonathan GreenbergApr 19, 2012 at 6:50 pmApr 27, 2012 at 6:51 pm
• 26

#### [R] Min , Max

Hellow everyone, This code bellow will calculate average daily wind speed(measurements are taken every three hours).Any ideas how to take the Min and Max instead of average. library(Matrix) ...
 JonssonApr 27, 2012 at 3:46 pmApr 30, 2012 at 3:06 pm
• 19

#### [R] introducing R to high school students

I participate peripherally on a listserve for middle- and high-school science teachers. Sometimes questions about graphing or data analysis come up. I never miss an opportunity to advocate for R ...
 Christopher W RyanApr 18, 2012 at 2:46 amApr 22, 2012 at 3:20 pm
• 18

#### [R] grouping

Hi all, Assume that I have the following 10 data points. x=c( 46, 125 , 36 ,193, 209, 78, 66, 242 , 297 , 45) sort x and get the following y= (36 , 45 , 46, 66, 78, 125,193, 209, 242, 297) I want to ...
 ValApr 3, 2012 at 12:47 pmApr 3, 2012 at 7:11 pm
• 17

#### [R] understanding the FUNCTION function

Hello, I am trying to understand why the FUNCTION used in several codes, won't create the object after it finishes running the code. For instance, look at the following: Number<- function(x) ...
 MichaelybApr 26, 2012 at 2:06 amApr 26, 2012 at 7:57 pm
• 17

#### [R] Assignment problems

The text below is a part of, some work I have to do, which is due in 2 days and I am strung up with a lot of other stuff, so I was hoping someone would take 5 mins and help me ?? Here is a part of my ...
 Phillip03Apr 22, 2012 at 6:54 pmApr 25, 2012 at 11:09 am
• 15

#### [R] User defined panel functions in lattice

Hi I have a problem with passing line and symbol parameters to user defined panel functions I had a look at the archives and created a panel function on what was shown and on panel.loess. I could not ...
 Duncan MackayApr 19, 2012 at 8:24 amApr 22, 2012 at 2:39 am
• 15

#### [R] How do I get a rough quick utility plot of a time series?

The following is an R run showing that it has read a 2000 point time series having two values at each time. What is the simplest way to plot the data? It seems like the whatever plot routine should ...
 HurrApr 1, 2012 at 3:06 amApr 7, 2012 at 1:52 pm
• 14

#### [R] check if excel file is

Hello again, I'd like to determine if an Excel file is open or writable. Can anyone help me with that? I write some stats to an .xlsx Excel file using the xlsx package. I can't write to the file ...
 Ben quantApr 27, 2012 at 4:08 pmApr 30, 2012 at 12:34 pm
• 14

#### [R] Errors Updating Libraries (2.15)

I just upgraded from 2.14 to 2.15 and have run into an issue upgrading libraries that I've not had in previous version upgrades. For example, trying to install reshape2 for 2.15 throws errors and I ...
 Rich ShepardApr 24, 2012 at 3:47 pmApr 24, 2012 at 11:16 pm
• 13

#### [R] pause code in R code?

How do I write something like "pause()" in R code like in other programming languages so I can just press something to let the program continue? -- View this message in context ...
 HurrApr 1, 2012 at 11:33 amApr 7, 2012 at 3:48 pm
• 13

#### [R] trouble with small multiples on a date variable

Hello, I am loading a DBF file into R via JGR and am having trouble creating small multiple histograms on a date variable. Hist() handles the variable correctly. But I've been unable to work with ...
 DavidepsApr 1, 2012 at 2:27 amApr 4, 2012 at 11:00 pm
• 12

#### [R] How to remove \$ (Dollar sign) from string

How do I remove a "\$" character from a string sub() and gsub() with "\$" or "\\$" as pattern do not work. Error: unexpected input in "sub(\" Thanks -- Nevil Amos Molecular Ecology Research Group ...
 Nevil AmosApr 10, 2012 at 11:34 amApr 22, 2012 at 10:41 am
• 12

#### [R] Sort out number on value

Can anyone help me maybe with a question I can seem to find an answer on. I have this: x = c(1, 5, 70, 53, 7, 29, 75, 37, 30, 11) And I would like to have the numbers above 20 selected out. But I ...
 YellowApr 20, 2012 at 10:26 amApr 20, 2012 at 7:25 pm
• 12

#### [R] Creating a loop with an indefinite end term

Everyone, I'm very new to R, especially when it comes to loops and functions, so please bear with me if this is an elementary question. I cannot seem to figure out how to construct a loop which runs ...
 Steve LavrenzApr 10, 2012 at 2:48 pmApr 10, 2012 at 5:59 pm
• 12

#### [R] filling the matrix row by row in the order from lower to larger elements

Hello, everybody! I have a matrix "input" (see example below) - with all unique entries that are actually unique ranks (i.e., start with 1, no ties). I want to assign a value of 100 to the first row ...
 Dimitri LiakhovitskiApr 6, 2012 at 7:49 pmApr 8, 2012 at 8:58 pm
• 11

#### [R] Merge function - Return NON matches

Hi there, I wish to merge a common variable between a list and a data.frame & return rows via the data.frame where there is NO match. Here are some details: The list, where the variable/col.name = ...
 RHelpPleaseApr 26, 2012 at 7:33 pmApr 27, 2012 at 4:08 pm
• 11

#### [R] PCA sensitive to outliers?

Hi all, I found that the PCA gave chaotic results when there are big changes in a few data points. Are there "improved" versions of PCA in R that can help with this problem? Please give me some ...
 MichaelApr 20, 2012 at 4:20 amApr 23, 2012 at 1:16 pm
• 11

#### [R] Drawing a line in xyplot

i am trying to replicate the following graph using xyplot : attach(x) plot ( jitter(type), mortality, pch, xlim = c(0.25, 3.75)) lines ( c(1-0.375,1.375) , c ( median(mortality[type==1]), ...
 WcheckleApr 7, 2012 at 1:41 amApr 9, 2012 at 7:41 am
• 11

#### [R] Rgui maintains open file handles after Sweave error

Hello Folks, When I run the document below through sweave, rgui.exe/rsession.exe leaves a file handle open to the sweave-001.pdf graphic (as verified by process explorer). Pdflatex.exe then crashes ...
 Alexander ShenkinApr 4, 2012 at 7:25 pmApr 5, 2012 at 6:22 pm
• 10

#### [R] take data from a file to another according to their correlation coefficient

Hi everyone. I have a question about a work on R I have to do for my job. I have temperature data coming from 70 weather stations. One data file corresponds to one station for one year (so 70 files ...
 Jeff6868Apr 23, 2012 at 10:42 amMay 3, 2012 at 8:13 am
• 10

#### [R] How to add specific column to data.set?

Hi I have a data.set with 7 lists, with over 7000 observations in each list. to of the lists contain country names. like: aus dnk fra aus usa aut itl usa . . . etc. My dilemma is that I want to add ...
 Phillip03Apr 17, 2012 at 4:40 pmApr 19, 2012 at 5:11 am
• 10

#### [R] Can a matrix have 'list' as rows/columns?

After a lot of processing I get a matrix into M. I expected each row and column to be a vector. But it is a list. R-Inferno says... "Arrays (including matrices) can be subscripted with a matrix of ...
 Worik RApr 17, 2012 at 4:13 amApr 19, 2012 at 3:31 am
• 10

#### [R] packages install dependencies

Hello R-Members I have to install several R packages on a Unix server which doesn't have internet connection. I downloaded some packages manually and I installed it from source using the command R ...
 Mail BioinfoApr 16, 2012 at 1:41 pmApr 18, 2012 at 2:08 pm
• 10

#### [R] filling small gaps of N/A

Hi everybody, I'm a new R french user. Sorry if my english is not perfect. Hope you'll understand my problem ;) I have to work on temperature data (35000 lines in one file) containing some missing ...
 Jeff6868Apr 3, 2012 at 8:52 amApr 4, 2012 at 1:00 pm
• 9

#### [R] generate random numbers for lotteries

?Hi, I am working with lotteries and I need to generate two sets of uniform random numbers. Requirements: 1) each set has 60 random numbers 2) random numbers in the first set are taken from an ...
 Vale FaraApr 27, 2012 at 10:10 pmApr 30, 2012 at 2:33 am
• 9

#### [R] Splitting data into test and train (80:20) kepping attributes similar

Hi, I am trying to do some predictive modeling around attrition and want to split the dataset into test and train (80:20) and keep the ratio of attritees:non attrites same. In my dataset the ...
 Dwaipayan DasguptaApr 24, 2012 at 3:38 pmApr 26, 2012 at 12:17 pm
• 9

#### [R] difficulty in Formatting time series data

Dear R-Gurus I have a data frame (from CSV file) which has its first column called Date. The Date is in the format mm/dd/yyyy. I was trying to get the weekday for these dates and I tried using wday() ...
 Raghuraman RamachandranApr 22, 2012 at 4:53 pmApr 22, 2012 at 6:42 pm
• 9

#### [R] loss of information in pdf plots

Hi there is it possible that pdfs generated using the pdf() function with default settings leads to loss of information? I was plotting copy number changes from Agilent 180k data in form of ...
 Unger, Kristian, Dr.Apr 17, 2012 at 12:08 pmApr 17, 2012 at 2:35 pm
• 9

#### [R] Calculating NOEL using R and logistic regression - Toxicology

Hello, I used the glm function in R to fit a dose-response relationship and then have been using dose.p to calculate the LC50, however I would like to calculate the NOEL (no observed effect level), ...
 Danielle DuncanApr 2, 2012 at 10:45 pmApr 4, 2012 at 7:15 pm
• 8

#### [R] 7 arguments passed to .Internal(identical) which requires 6

Hello, I've just installed R-2.15.0 (I've had R 2.13.2 before it and I've deleted everything before I started to install new version). When I've tried to run my script by command "source()" I ...
 KrtekApr 11, 2012 at 9:58 amMay 4, 2012 at 2:10 pm
• 8

#### [R] Returning the coef from two coordinates

Thank you to everyone in this forum that has been helping me with the basic R skills while I learn to apply them. I would like to take the coefficient of two coordinates. One of them comes from two ...
 Hans ThompsonApr 27, 2012 at 7:04 pmApr 29, 2012 at 3:06 pm
• 8

#### [R] How to take ID of number > 7.

I figured out something new that I would like to see if I can do this more easy with R then Excel. I have these huge files with data. For example: DataFile.csv ID Name log2 1 Fantasy 5.651 2 New ...
 YellowApr 22, 2012 at 11:03 amApr 23, 2012 at 1:16 pm
• 8

#### [R] simple read in with zoo using POSIXlt

Easy question a bit. So here's my code: http://pastebin.com/F4iQPVy5 I am trying to read in a series of timestamps. However with POSIXlt as FUN in read.zoo, the output is merely two numbers and is ...
 KnaveroApr 14, 2012 at 12:30 pmApr 16, 2012 at 3:33 am
• 8

#### [R] Saving multiple plots using tiff function

Dear R experts, I am trying to save three plots using tiff graphics devices; however the following code only produces two files (Rplot002.tif and Rplot003.tif) showing figures 1 and 3. Here is a ...
 John SApr 6, 2012 at 6:17 pmApr 13, 2012 at 10:44 am
• 8

#### [R] How do Sweave users collaborate with Word users?

Hello All, I'm getting my workflow switched over to Sweave, which is very cool. However, I collaborate with folks (as many of you must as well) who use Word to Track Changes amongst a group while ...
 Alexander ShenkinApr 7, 2012 at 8:54 pmApr 10, 2012 at 2:14 am
• 8

#### [R] Problems with CRAN package Ryacas

R version 2.15.0 (2012-03-30) Platform: x86_64-pc-linux-gnu (64-bit) locale: [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C [3] LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8 [5] LC_MONETARY=en_US.UTF-8 ...
 Kjetil HalvorsenApr 8, 2012 at 6:56 pmApr 10, 2012 at 1:09 am
• 8

#### [R] Difference between spec.pgram & spec.ar

Hi there, Can someone explain what the difference between spec.pgram and spec.ar is? I understand that they attempt to do the same thing one using an AR estimation of the underlying series to ...
 Bazman76Apr 8, 2012 at 6:39 pmApr 9, 2012 at 6:34 pm
• 8

#### [R] Error in integrate(int.fn, lower = 0, upper = Inf) : evaluation of function gave a result of wrong length

Hi, i am writing a function to plot a pdf functions of a Generalized normal laplace distribution. The code is this { y = x-rho*mu cf.fn = function(s){ cplex = complex(1,0,1) temp1 = ...
 GuaramyApr 8, 2012 at 5:28 pmApr 9, 2012 at 2:28 pm
• 8

#### [R] recover lost global function

Since R has the same namespace for functions and variables, Is there a way to prevent R from overriding globals or at least warning when I do that or at least warning when I replace a functional ...
 Sam SteingoldApr 4, 2012 at 8:52 pmApr 5, 2012 at 3:19 pm
• 7

#### [R] Help with stemDocument

Hi, All: I am new to R and tm package. I'm trying to do the stemming using tm_map() and it doesn't seem to work: *I used:* *Where t_cmts is the corpus object, the results is:* bottle loose box abt ...
 Deborah H. DengApr 13, 2012 at 7:27 amMay 18, 2012 at 3:30 pm
• 7

#### [R] Scatter plot / LOESS, or LOWESS for more than one parameter

Hi folks. If I have the following in my "data" event pH1 pH2 1 4.0 6.0 2 4.3 5.9 3 4.1 6.1 4 4.0 5.9 and on and on..... for about 400 events Is there a way I can get R to plot event vs. pH1 and event ...
 David DoyleApr 24, 2012 at 3:26 amMay 1, 2012 at 2:49 am
• 7

#### [R] Unable to compile & install rggobi

I am currently using R 2.15.0 with R Tools 2.15 (in Windows XP). I downloaded the source for RGgobi and extracted it to a folder. Then I tried compiling and installing with the following command and ...
 Indrajit SenguptaApr 27, 2012 at 7:56 amApr 29, 2012 at 6:54 am
• 7

#### [R] How to test if a slope is different than 1?

Dear R-helpers, I would like to test if the slope corresponding to a continuous variable in my model (summary below) is different than one. I would appreciate any ideas for how I could do this in R, ...
 Mark NaApr 23, 2012 at 6:11 pmApr 27, 2012 at 2:08 am
• 7

#### [R] Basic matrix manipulation problem

Hello, this forum was very helpful yesterday with a simple question I had on working with tables. What function will I need to use to do the following. Move matrix a: A B C D x 1 2 3 4 y 5 6 7 8 to ...
 Hans ThompsonApr 24, 2012 at 8:36 pmApr 26, 2012 at 10:03 am
• 7

#### [R] Reading SPSS: underlying numerical codes

Dear people, I have got a question concerning the underlying numerical codes when reading an SPSS file into R. I used the package foreign and when I look at a variable I get the verbal codes. I would ...
 Marion WentyApr 12, 2012 at 10:28 amApr 24, 2012 at 8:03 am
• 7

#### [R] Problem with Tukey test

I'm new using R im trying to do a tukey test, but when i see the results the p value results in NA im guessing its because i have missing values but im not sure how to fix it AnovaModel.2 <- aov(area ...
 Danipaty13Apr 20, 2012 at 1:21 pmApr 21, 2012 at 5:11 am
• 7

#### [R] Amelia error

Hi, Encountering the following error using Amelia - Error in if (sum(non.vary == 0)) { : argument is not interpretable as logical In addition: Warning message: In FUN(X[[34L]], ...) : NAs introduced ...
 Gaurav SoodApr 18, 2012 at 5:33 pmApr 18, 2012 at 6:45 pm
• 7

#### [R] Seemingly simple "lm" giving unexpected results

I can't figure out why this is returning an NA for the slope in one case, but not in the other. I can tell that R thinks the first case is singular, but why isn't the second? ## Define X and Y ## ...
 Gene LeynesApr 13, 2012 at 8:20 pmApr 16, 2012 at 3:44 pm
• 7

#### [R] Kaplan Meier analysis: 95% CI wider in R than in SAS

Hello All, ? Am replicating in R an analysis I did earlier using SAS. See this as a test of whether I'm ready to start using R in my day-to-day work. ? Just finished replicating a Kaplan Meier ...
 Paul MillerApr 13, 2012 at 12:13 pmApr 16, 2012 at 2:42 pm