[R] combining numeric vector and column in a data frame

2012-07-10 Thread Adrian Johnson
Hi: I am trying to map column names of a matrix to another data frame and get values in a different column of data frame I have a matrix m. > my.numeric vec <- m[1,] > my.numeric.vec a b cd ef 2 1 49 10 3 ## my data frame = df1 > df1 fileNametype sta

Re: [R] Extracting arithmetic mean for specific values from multiple .txt-files

2012-07-10 Thread vimmster
Dear Rui, 1) With test subject I mean each file (I have posted three similar files above (2, 50 and 1112), but each test subject has one exact file (which differs of course! --> 2, 50 an 1112 are the same file but I renamed it for the problem described ans solved above). In this file the vpNum is

[R] combining numeric vector and column in a data frame

2012-07-10 Thread Simon Knapp
combined <- data.frame(mnv=my.numeric.vec[df1$fileName], type=df1$type) sorted <- combined[order(rownames(combined)),] On Wed, Jul 11, 2012 at 8:38 AM, Adrian Johnson wrote: > Hi: > I am trying to map column names of a matrix to another data frame and > get values in a different column of data

Re: [R] HELP me please with import of csv to R

2012-07-10 Thread Sarah Goslee
That is silly, but I have learned something. Thanks. Though honestly, I've never seen the advantage of read.csv() over the more versatile read.table(). Sarah On Tuesday, July 10, 2012, peter dalgaard wrote: > > On Jul 10, 2012, at 21:44 , Sarah Goslee wrote: > > > > But note that if sep=";" the

Re: [R] HELP me please with import of csv to R

2012-07-10 Thread peter dalgaard
On Jul 11, 2012, at 01:24 , Sarah Goslee wrote: > That is silly, but I have learned something. Thanks. > (The silliest bit was when someone decided that numeric data files should use locale-dependent conventions, notably decimal separators...) > Though honestly, I've never seen the advantage o

[R] ifelse help

2012-07-10 Thread Jeff
I'm sure this is easy, but I'm new to R and can't find any example of the following. Here's what I'm trying to do in pseudo-code. data$newvar <- ifelse(data$oldvar1 == 8, 1,data$oldvar2) In other words, if the existing variable equals 8, then the new variable should equal 1, otherwise the n

Re: [R] ifelse help

2012-07-10 Thread jim holtman
Seems to work for me: > x <- data.frame(old1 = sample(c(1,2,8), 10, TRUE), old2 = 1:10) > x$new <- ifelse(x$old1 == 8, 1, x$old2) > x old1 old2 new 1 11 1 2 22 2 3 23 3 4 84 1 5 15 5 6 86 1 7 87 1 8 28 8 9 2

Re: [R] ifelse help

2012-07-10 Thread Nordlund, Dan (DSHS/RDA)
> -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- > project.org] On Behalf Of Jeff > Sent: Tuesday, July 10, 2012 5:26 PM > To: r-help > Subject: [R] ifelse help > > > I'm sure this is easy, but I'm new to R and can't find any example of > the following.

Re: [R] ifelse help

2012-07-10 Thread Jeff
At 07:41 PM 7/10/2012, you wrote: Seems to work for me: > x <- data.frame(old1 = sample(c(1,2,8), 10, TRUE), old2 = 1:10) > x$new <- ifelse(x$old1 == 8, 1, x$old2) > x Thanks Jim and Dan. The problem ended up with a missing values issue that threw me off. When your post confirmed that my co

Re: [R] ifelse help

2012-07-10 Thread Jeff Newmiller
You failed to tell us any of: the actual code you used, the data you were working with, or the actual error you got. Your "pseudo-code" looks okay to me, so I suggest you read the Posting Guide and try again. (Anything other than a complete reproducible example of your problem is unlikely to eli

Re: [R] -1.1 - 0.1 + 1.2 is NOT null! Why?

2012-07-10 Thread Erdal Karaca
german "Null" == english "zero" :-) 2012/7/10 Rolf Turner > > > In addition to taking cognisance of Richard Heiberger's reply you > should also learn to distinguish between the concept of "null" and > "zero". They are not at all the same thing. > > cheers, > > Rolf Turner > > > On 1

Re: [R] HELP me please with import of csv to R

2012-07-10 Thread FJ M
Try putting the data into some kind of object. I'm not sure what R does with the data from read.csv. I always 1) read the data into an object 2) print the data out 3) attach the data so that the headers become objects that contain the data 4) and yes, print the data out using ls 5) check the ou

Re: [R] RGL 3D curvilinear shapes

2012-07-10 Thread PatGauthier
Well I've figures out a painful way of doing it with triangles 3d, as suggested in another post by Duncan Murdoch. The code is disgusting, but it works. x <- c(0,0.75,75.75,150.75,225.75,300.75,375.75,450.75,525.75,600.75,675.75, 675.75,0, 0,0.5,50.5,100.5,150.5,200.5,250.5,300.5,350.5,4

Re: [R] R-help Digest, Vol 113, Issue 13

2012-07-10 Thread Terry Therneau
--- A non-text attachment was scrubbed... Name: homo_jawt_pgtwhr24.png Type: image/png Size: 9100 bytes Desc: not available URL:<https://stat.ethz.ch/pipermail/r-help/attachments/20120710/754cabcd/attachment-0001.png> -- Message: 2 Date: Tue, 10 Jul 2012 06:58:20 -04

Re: [R] combining numeric vector and column in a data frame

2012-07-10 Thread arun
Hi Try this: df1<-read.table(text="  fileName    type  status  b  N  alive  a  T    dead  d  N  alive  c  T  dead  f  N    alive  e  T    dead  ",sep="",header=TRUE) mynumeric.vec<-c(a=2,b=1,c=4,d=9,e=10

Re: [R] -1.1 - 0.1 + 1.2 is NOT null! Why?

2012-07-10 Thread arun
Hi, Perl: perl -e 'print -1.1-0.1+1.2. "\n";' -2.22044604925031e-16 perl -e 'print -1.2-0.2+1.4. "\n";' 0 A.K. - Original Message - From: massimodisasha To: ollestrat ; r-help@r-project.org Cc: Sent: Tuesday, July 10, 2012 6:23 PM Subject: Re: [R] -1.1 - 0.1 + 1.2 is NOT null! Why?

[R] How to connect .mdb file

2012-07-10 Thread imnew
Hi, I'm currently having some problem connect .mdb file into R. I've installed the RODBC packages and I do the code this way: channel <- odbcConnectAccess("C:/Users/Documents/XYZ") channel and it gave me this : RODBC Connection 3 Details: case=nochange DBQ=C:\USers\JieYi\Documents\NYP\IPP\GCR D

Re: [R] Read vector as multi-dimensional data in R by row

2012-07-10 Thread arun
Hi HJ, No problem. By changing the order of numbers in both perm and dim, you can create different combinations A.K. - Original Message - From: "yhj...@googlemail.com" To: arun Cc: Sent: Tuesday, July 10, 2012 7:25 PM Subject: Re: [R] Read vector as multi-dimensional data in R by r

Re: [R] How to use external image with R plot?

2012-07-10 Thread Manish Gupta
Hi, I need to position arrow according to content of data dynamically. let's say i have vector c(2,3,56,9) and i need to put arrow at 56 dynamically. How can i use above method. Regards -- View this message in context: http://r.789695.n4.nabble.com/How-to-use-external-image-with-R-plot-tp4635

[R] The following object(s) are masked from ‘package:stats’

2012-07-10 Thread David
My apologies in advance as this seem like an easy thing to fix. I am quite new to using R. I am doing my thesis at the moment and I am trying to use the extremes package. However, when I try to access it I get this message: The following object(s) are masked from ‘package:stats’: > library( extRe

Re: [R] The following object(s) are masked from ‘package:stats’

2012-07-10 Thread Charlie Friedemann
David, That message is not an error. It is simply telling you that there are functions named qqnorm an qqplot in the extRemes package that are "masking" functions of the same name in the stats package. Functions in a package being loaded with the same names as functions in a package already loaded

Re: [R] HELP me please with import of csv to R

2012-07-10 Thread R. Michael Weylandt
On Tue, Jul 10, 2012 at 4:23 PM, FJ M wrote: > 3) attach the data so that the headers become objects that contain the data > attach(v_data) This is a discouraged practice as it leads to difficult to trace errors and non-local effects. Some "big names" of the R universe suggest it [I think V of V

Re: [R] How to connect .mdb file

2012-07-10 Thread Jeff Newmiller
Are you sure XYZ is the name of the MDB file? Perhaps you are being fooled by the default filename display that omits the extension? --- Jeff NewmillerThe . . Go Live... DCN:B

Re: [R] combining numeric vector and column in a data frame

2012-07-10 Thread Rui Barradas
Hello, Here are two ways of doing it. df1 <- read.table(text=" fileNametype status b N alive a Tdead d N alive c T dead f Nalive e Tdead ", header=TRUE) df1 my.num

Re: [R] Extracting arithmetic mean for specific values from multiple .txt-files

2012-07-10 Thread vimmster
Dear Rui, 1) With test subject I mean each file (I have posted three similar files above (2, 50 and 1112), but each test subject has one exact file (which differs of course! --> 2, 50 an 1112 are the same file but I renamed it for the problem described ans solved above). In this file the vpNum is

Re: [R] How to connect .mdb file

2012-07-10 Thread Mikhail Titov
imnew writes: > Hi, I'm currently having some problem connect .mdb file into R. > I've installed the RODBC packages and I do the code this way: > > channel <- odbcConnectAccess("C:/Users/Documents/XYZ") > > I have a total of 5 tables in the .mdb database. any one can help me with > how to get t

Re: [R] problem for installing rgdal

2012-07-10 Thread Prof Brian Ripley
On 10/07/2012 17:35, stanislas rebaudet wrote: Hello, I run [R] 2.14 on Mac OS 10.6 and I've been desperately trying to install rpy2 in order to compute spatial statistics on QGIS 1.7.3. rpy2 is dependent upon the rgdal [R]package that I've been unable to install in spite of up to date version

<    1   2