Re: [R] convert to grid file

2011-09-01 Thread Petr PIKAL
be to make vectors of row and columns coordinates. But it depends on what you want to do with your data. Regards Petr Thanks From: Petr PIKAL petr.pi...@precheza.cz To: azam jaafari azamjaaf...@yahoo.com Cc: R-help r-help@r-project.org Sent: Thursday, September 1, 2011 8:59 AM

Re: [R] convert to grid file

2011-09-01 Thread Petr PIKAL
= as.vector(d$z[,ncol(d$z):1]))) It doesn't work and I think it is wrong. Thanks From: Petr PIKAL petr.pi...@precheza.cz To: azam jaafari azamjaaf...@yahoo.com Cc: R-help r-help@r-project.org Sent: Thursday, September 1, 2011 10:22 AM Subject: Re: [R] convert to grid file Hi

[R] Odp: reshape/aggregate

2011-08-31 Thread Petr PIKAL
Hi Hi all, I apologize for this probably stupid question, but I really can't figure it out. I have a dataframe like this: group - c(rep('A', 8), rep('B', 15), rep('C', 6)) time - c(rep(seq(1:4), 2), rep(seq(1:5), 3), rep(seq(1:3), 2)) value - runif (29, 1, 10) dfx - data.frame (group,

Re: [R] : reshape/aggregate

2011-08-31 Thread Petr PIKAL
something like: When performing summary values for a data frame according to levels of a factor you shall use syntax ddply(.data, .variables, summarise, .fun, ...) Regards Petr Best, Ista On Wed, Aug 31, 2011 at 7:13 AM, Petr PIKAL petr.pi...@precheza.cz wrote: Hi Hi all, I

Re: [R] Showing zero frequencies with xtabs

2011-08-30 Thread Petr PIKAL
Hi Hi, Does anyone know how to show zero frequencies variable levels with the xtabs command? They show with the table(x,y) command but I need to apply weight to frequency tables and I also need to cbind several tables together, which implies that they all need to show the same number

Re: [R] Help with the 'reshape' package

2011-08-30 Thread Petr PIKAL
Hi Hi all, I am reading previous posts and guidance on the 'reshape' package in order to solve the simple problem below. Thinking that this might be very trivial for most of you, I thought there could be a fast solution coming from you guys, and I´d be very thankful for that. I have

[R] Odp: all combinations of the elements of two vectors

2011-08-29 Thread Petr PIKAL
Hi Dear R-help readers, I'm sure this problem has been answered but I can't find the solution. I have two vectors v1 - c(a,b) v2 - c(1,2,3) I want an easy way to produce every possible combination of v1, v2 elements Ie I want to produce c(a1,a2,a3, b1,b2,b3) Another option is

Re: [R] Placing a column name in a variable XXXX

2011-08-29 Thread Petr PIKAL
Hi or if Dan prefers data frame (which is also a list) CInew2 -function(x,alpha){ data.frame(variable = deparse(substitute(x)), mean=mean(x), alpha = alpha) } CInew2(JOBSTAT, 0.05) variable mean alpha 1 JOBSTAT 0.4567117 0.05 Regards Petr In this case you want to use a 'list'

[R] Odp: Extracting values in table

2011-08-29 Thread Petr PIKAL
Hi Hi All, I am a beginner in programming in r and please do forgive me if my question seems to be silly and sometimes not understandable. 1. we have a list of elements in a list say: ls-list(N,E,E,N,P,E,M,Q,E,M) 2. We have an another list of tables in a list say: n - list(M,

Re: [R] read.table truncated data?

2011-08-26 Thread Petr PIKAL
Hi Thanks, Jim. quote='' works. And then I found a single quote in each of these lines: 3262 10403 17544 24685 31826 38967 None of them near the position the table got truncated. Why is it? And read.table is a great function. Is it possible for it to give a warning message when

[R] Odp: Using write.table i have a table with two columns i would like to save it as an excel file

2011-08-26 Thread Petr PIKAL
Hi I use this kind of output to excel if the table is not too big write.table(tab, clipboard, sep = \t, row.names = F) In excel sheet I press ctrl - V to copy from clipboard Regards Petr Using write.table i would like to save data as an excel file to a folder. I am not too sure how to

Re: [R] cbind giving NA's?

2011-08-26 Thread Petr PIKAL
Hi On 26 August 2011 03:37, R. Michael Weylandt michael.weyla...@gmail.com wrote: If you could, dput() them so we can see everything about them. You also might see if merge() gives you more expected behavior Ok... dput(a) structure(c(7.6343, 7.6343, 7.5458, 7.4532, 7.404,

Re: [R] cbind giving NA's?

2011-08-26 Thread Petr PIKAL
I was rather too quick It has probably something to do with versions of zoo and xts after updating to zoo 1.7.4 and xts 0.8.2 I got with your examples merge(a,b) ZWD.UGX SCHB.Close 2010-04-01 NA 28.02 2010-04-01 7.6343 NA 2010-04-02 7.6343 NA 2010-04-03

[R] Odp: Boxplot orders

2011-08-25 Thread Petr PIKAL
Hi Hi there, I have length data of an organism over the year and I want to make a boxplot. I get the boxplot just fine but the months are all out of order. In the data set they are in order from Jan-Dec...how can I fix this problem? Probably months are either character or factor

[R] Odp: Howto convert Linear Regression data to text

2011-08-25 Thread Petr PIKAL
Dear all, How can I covert lm data to text in the form of y=ax+b, r2 and how do I calculate R-squared(r2)? Thanks. Code: x=18:29 y=c(7.1,7,7.7,8.2,8.8,9.7,9.9,7.1,7.2,8.8,8.7,8.5) res=lm(y~x) I am not sure what do you mean by text. There are some lm extraction functions for

[R] Odp: {R} How to extract correctly from vector?

2011-08-25 Thread Petr PIKAL
Dear list, I have problem that I cannot solve and would like to ask your opinion. I tried to ask a few days ago already but got no answer and all my attempts to solve it by myself since then failed. Sorry for repeated posting! Here the problem broken down a bit. My problem

Re: [R] spectral analysis

2011-08-24 Thread Petr PIKAL
Is there anything in R similar to spectogram command in matlab? As I do not use matlab I can not know what spectogram does. What is wrong with fft or spectrum functions? Regards Petr On Tue, Aug 23, 2011 at 10:20 AM, Petr PIKAL petr.pi...@precheza.cz wrote: Hi Hi all, I am

[R] Odp: boxplot from mean and SD data

2011-08-24 Thread Petr PIKAL
Hi Dear all, I have a dataset of 3 categorical factors, the mean and the standard deviation of each value. I want to use these values to plot a boxplot, grouped by each of the 3 categorical factors (24 boxplots in total). I don't have a clue on how to do the boxplot from mean and SD

Re: [R] Sequence

2011-08-23 Thread Petr PIKAL
Hi as far as I understand your question it seems to me that round(5*(1.4^(0:10))) gives you your sequence and cumsum(round(5*(1.4^(0:10 gives you summary sequence. Regards Petr I definitely used too much lines s of code because I still don't know how to do some staff. but it

[R] Odp: Mapping strings to integers

2011-08-23 Thread Petr PIKAL
Hi Dear All, I am quite a newbie to R. Trying to learn it these days. Sorry for asking such a basic question, but could you kindly tell me how to map unique string values to integers in a data frame? I have a graph which has, most of its, vertices' attributes in a string format. I would

[R] Odp: spectral analysis

2011-08-23 Thread Petr PIKAL
Hi Hi all, I am trying to do spectral analysis of a time series data. But I am not sure how to do it. Can anyone tell me if there are any package I can use to do the analysis using fast fourier transform? Maybe ?fft or ?spectrum Regards Petr Thanks in advance. Cassie

Re: [R] I have a problem with R!!

2011-08-22 Thread Petr PIKAL
Hi Your code is rather baroque and it is difficult to see what is exactly going on without having appropriate data. I does not consider your process of reading data from Excel problematic. Maybe the difference is in that d- rnorm(whatever) produces vector while d- read.delim(clipboard,

Re: [R] Chi square test on data frame

2011-08-18 Thread Petr PIKAL
Hi r-help-boun...@r-project.org napsal dne 17.08.2011 21:07:43: Dear Michael, Thanks a lot for your reply and for your help.I was struggling so much but your suggestion showed me a path to the solution of my problem.I have tried your code on my data frame step wise and it looks fine to

[R] Odp: how to analysis a dataset with some missing value?

2011-08-18 Thread Petr PIKAL
Hi my qustion is if my miss value in my dataset is - for example : 1 3 21 33 - 23 33 - how can I plot or analysis this dataset ignoring the missing value ? thanks . Use NA instead of - and things will get better x-as.numeric(read.table(textConnection(1 3 21 33 -

Re: [R] How to get the descriptive statistic of the whole dataframe?

2011-08-18 Thread Petr PIKAL
Hi look into the *apply series of functions. In your case apply(name.of.your.data.frame,2,min) or apply(name.of.your.data.frame,2,max) will do. You can also put any summary function to your liking instead of min/max. And summary has its own data frame method so simply

[R] queue waiting times comparison

2011-08-18 Thread Petr PIKAL
Hallo all I try to find a way how to compare set of waiting times during different periods. I tried learn something from queueing theory and used also R search. There is plenty of ways but I need to find the easiest and quite simple. Here is a list with actual waiting times. ml -

Re: [R] queue waiting times comparison

2011-08-18 Thread Petr PIKAL
for comparison of two or more sets with such long tailed distribution? - Trimmed mean?, Median?, ... Thanks. Regards Petr On Thu, Aug 18, 2011 at 7:49 AM, Petr PIKAL petr.pi...@precheza.cz wrote: Hallo all I try to find a way how to compare set of waiting times during different periods. I

[R] Odp: what characteristics of model curve do parameters denote

2011-08-18 Thread Petr PIKAL
Hi Dear list, I'm trying to fit a chapman-richards equation to my data, only I cannot interpret the parameters a, b and d. I know that the parameter b denotes the asymptote, but for the others I couldn't figure out. But No. d Is asymptote. You can easily check how the function behives by

Re: [R] queue waiting times comparison

2011-08-18 Thread Petr PIKAL
. Thank you for your time and an answer. Best regards Petr On Thu, Aug 18, 2011 at 8:52 AM, Petr PIKAL petr.pi...@precheza.cz wrote: Hallo Jim Thank you and see within text. jim holtman jholt...@gmail.com napsal dne 18.08.2011 14:09:11: I am not sure why you say that lapply(ml, mean

Re: [R] Renaming levels of a factor in a dataframe

2011-08-15 Thread Petr PIKAL
Hi Here's an example of relevel used to relevel and combine groups InsectSprays2-InsectSprays levels(InsectSprays2$spray) levels(InsectSprays2$spray)-list(new1=c(A,C),YEPS=c(B,D,E),LASTLY=F) levels(InsectSprays2$spray) InsectSprays2 So for you try... levels (Data1$Site) -

[R] Odp: write.table extra column

2011-08-15 Thread Petr PIKAL
Hi In the following data.frame there are 6 columns, but 7 are written to the CSV file. install.packages(pmlr) library(pmlr) data(enzymes) write.table(enzymes, sep=,, eol=\n,file=albert.csv) see row.names option in ?write.table Regards Petr

Re: [R] To import data to R from Excel

2011-08-11 Thread Petr PIKAL
Hi In Excel, make sure that your data has a format that corresponds to an R data frame (first row with column names, consistent column size and data type). Export your .XLS worksheet as .CSV file (mydata.csv). In R, read it into a data frame with read.csv( mydata.csv ) Another

[R] Odp: nls, how to determine function?

2011-08-09 Thread Petr PIKAL
Hi Hi R help, I am trying to determine how nls() generates a function based on the self-starting SSlogis and what the formula for the function would be. I've scoured the help site, and other literature to try and figure this out but I still am unsure if I am correct in what I am coming up

[R] Odp: assign names to vectors in loop

2011-08-09 Thread Petr PIKAL
Hi Dear List, I like to assign names to vectors in a loop. Here is a short example: DMUs - as.data.frame(matrix(c(b,c,d,a,e,h,i,f,g,j,k,l),ncol =7, nrow=10)) colnames(DMUs) - v_DMUs - c(a,b,c,d,e,f,g) for (i in v_DMUs) assign(paste(eff_val,i,sep=.),abs(rnorm(10))) Now I like to

[R] Odp: Fw: R function for Gage RR

2011-08-08 Thread Petr PIKAL
about how your function works? How is the input data structured? What is vysledek? (the response variable?) I was surprised to see very few posts about GRR on the R-help website, and packages. Any help you can offer is appreciated. [R] Odp: GRR - Best methods in R Petr

[R] Odp: How to see the previous commands after save workspace/load workspace ?

2011-08-05 Thread Petr PIKAL
Hi I did save workspace and when I load it, I can see the variables, using ls(). But I cannot see the commands from the program I saved. How to do that? Perhaps you can check .Rhistory file. Regards Petr __ R-help@r-project.org mailing list

[R] Odp: Translate Sine Function in R?

2011-08-05 Thread Petr PIKAL
Hi Are you sure about sine fit? Seems to me that logistics would be better fit-nls(dat ~ SSlogis(x, Asym, xmid,scal), data = dat.df, start = list(Asym=90, xmid = 75, scal = -6)) plot(dat.df) lines(dat.df$x[complete.cases(dat.df)], predict(fit)) Regards Petr Hello, I'm trying to generate

[R] Odp: A problem of is.list function

2011-08-05 Thread Petr PIKAL
Hi Hi all I want to use function of is.list and is.data.frame in if-else statement, but I get a trouble. To replicate this trouble, I run codes like that: set.seed(123) x - rnorm(100) x - data.frame(matrix(x, 10, 10)) class(x) [1] data.frame is.list(x) [1] TRUE

[R] Odp: excel dates and times in R

2011-08-05 Thread Petr PIKAL
Hi Hello, I am having some fun dealing with dates and times. My input is a excel csv file with two columns with data in the following format: date time 25-Jun-1961 04:00:00 i.e. day - month - year hour:min:sec I would

[R] Odp: Scatter plot in R

2011-08-05 Thread Petr PIKAL
Hi Hi, I have 334 records, with two columns: Column (1): Resolution Column (2): Number of images with a specific resolution How can I make a scatter plot in R with this data? Is there a way to *import If you have your data in two column data frame you can just plot(your.data.frame)

Re: [R] Very silent R

2011-08-05 Thread Petr PIKAL
My version of R is not silent: Neither mine library(akima) Error in library(akima) : there is no package called ‘akima’ Regards Petr setwd(/notHere) Error in base::setwd(dir) : cannot change working directory library(notHere) Error in library(notHere) : there is no package called

[R] Odp: fit a 2-variables function to data

2011-08-05 Thread Petr PIKAL
Hi Dearl all, I have to fit a function y = f(x1, x2) to data experiemntal data describing the measured behavior of y. x1 and x2 are the independent variables. Could you suggest me wich R package can I use for this purpose? ?nls ?lm ?loess ?glm And there are plenty more if you do

Re: [R] fit a 2-variables function to data

2011-08-05 Thread Petr PIKAL
you should look to ?nls or maybe ?optim Regards Petr Paola. On Fri, Aug 5, 2011 at 2:55 PM, Petr PIKAL petr.pi...@precheza.cz wrote: Hi Dearl all, I have to fit a function y = f(x1, x2) to data experiemntal data describing the measured behavior of y. x1 and x2

Re: [R] Very silent R

2011-08-05 Thread Petr PIKAL
Hi r-help-boun...@r-project.org napsal dne 05.08.2011 15:21:34: khadeeja ismail haj...@yahoo.com Odeslal: r-help-boun...@r-project.org My version of R is not silent: setwd(/notHere) Error in base::setwd(dir) : cannot change working directory library(is notHere) Error in

[R] Odp: Counting rows given conditional

2011-08-04 Thread Petr PIKAL
Hi r-help-boun...@r-project.org napsal dne 04.08.2011 14:56:09: a217 aj...@case.edu Odeslal: r-help-boun...@r-project.org 04.08.2011 14:56 Komu r-help@r-project.org Kopie Předmět [R] Counting rows given conditional Hello, I have an input file that contains multiple

[R] Odp: conditional data replace (recode, change or whatsoever)

2011-08-03 Thread Petr PIKAL
Hi Hello, I have a big data.frame, a piece of it as follows. a b c d 1 58009 2010-11-02 0 NA 2 114761 NA 1 2008-11-05 3 184440 NA 1 2009-12-08 4 189372 NA 0 NA 5 105286

Re: [R] if function problems

2011-08-02 Thread Petr PIKAL
Hi another possibility is to use logical values properties (x 0)*x [1] -3 -2 -1 0 0 0 0 Regards Petr In addition to what David said: On Mon, Aug 1, 2011 at 6:57 PM, zoe_zhang 1987.zhan...@gmail.com wrote: Dear All, Sorry to bother I want to write a function in R using if

Re: [R] Standard Deviation of a matrix

2011-08-02 Thread Petr PIKAL
Hi Hi! The sample below should give you what you want: M = matrix(runif(100), 10, 10) sd(as.numeric(M)) So the as.numeric command is the key. It transforms the matrix to a 1D vector. Or alternatively without using as.numeric: M = matrix(runif(100), 10, 10) M dim(M) = 100 or

[R] Odp: Using Function

2011-08-02 Thread Petr PIKAL
Hi Hi, I have some simple statistics to calculate for a large number of variables. I created a simple function to apply to variables. I would like the variable name to be placed automatically. I tried the following function but is not working. desc = function(x){

[R] Odp: converting factor to numeric gives NAs introduced by coercion

2011-08-01 Thread Petr PIKAL
Hi Hi, I have a dataframe that I imported from a .txt file by: skogTemp - read.delim2(Skogaryd_shoot_data.txt, header=TRUE, fill=TRUE) and the data are factors, how can avoid factors from the beginning? Although the file contains both characters and numbers. You have got an answer

[R] Odp: Multifactor boxplots

2011-07-29 Thread Petr PIKAL
Hi Dear All I would like to produce interaction boxplots and this seems to work: par(mfrow=c(2,2)) A=sample(rnorm(50,50,10)) B=sample(rnorm(50,100,10)) Test=merge(A,B,by=0)#by=0 where 0 is the row.names TreatA=(gl(2,50,100,labels=c(High,Low)))

Re: [R] Big data and column correspondence problem

2011-07-26 Thread Petr PIKAL
Hi Re: [R] Big data and column correspondence problem Daniel, thanks for the answer. I will try to make myself i little bit clearer. Doing step by step I would have (using a loop trough the lines of 'A'): I am not sure if you are successful in your clarifying. 1. AA[1] is 4. As so, I

Re: [R] Problem with random number simulation

2011-07-25 Thread Petr PIKAL
Hi r-help-boun...@r-project.org napsal dne 25.07.2011 05:23:51: Re: [R] Problem with random number simulation Hi, I was just hoping someone could try running the program to see if they get any output. This is independent research. I just need to run this simulation to see how a

[R] Odp: How to merge a matrix and a dataframe with different types of columns

2011-07-25 Thread Petr PIKAL
Hi [R] How to merge a matrix and a dataframe with different types of columns Hi, I hope someone can help here. I have been scratching my head for many hours, trying to find out how to merge two datasets that were created by different means. The initial miniMarket contains dates

[R] Odp: Using t tests

2011-07-08 Thread Petr PIKAL
Hi [R] Using t tests Dear Sir, I am doing some work on a population of patients. About half of them are admitted into hospital with albumin levels less than 33. The other half have albumin levels greater than 33, so I stratify them into 2 groups, x and y respectively. I

[R] Odp: aggregation question

2011-07-07 Thread Petr PIKAL
Hi Hi, I am reading payment data like so 2010-01-01,100.00 2010-01-04,100.00 ... 2011-01-01,200.00 2011-01-07,100.00 and plot it aggregated per month like so library(zoo) df - read.csv(daily.csv, colClasses=c(d=Date,s=numeric)) z - zoo(df$s, df$d) z.mo - aggregate(z,

Re: [R] Odp: aggregation question

2011-07-07 Thread Petr PIKAL
, beside=T, col=1:2) Or you could look at ggplot2 package. Regards Petr In SQL something like GROUP BY MONTH, YEAR as opposed to GROUP BY YEAR, MONTH. greetings, el on 2011-07-07 11:08 Petr PIKAL said the following: [...] How do I get the monthly aggregated payments in different

[R] Odp: coefficients lm of data.frame

2011-07-07 Thread Petr PIKAL
Hi divide and conquer Split your data frame to required portions dat-as.data.frame(cbind(rnorm(1:12),rnorm(1:12))) dat.s-split(dat, rep(1:4, each=3)) apply lm to each portion sapply(dat.s, function(x) coef(lm(V2~V1, x))) 1 2 3 4 (Intercept)

[R] Odp: defining new variable

2011-07-01 Thread Petr PIKAL
Hi r-help-boun...@r-project.org napsal dne 01.07.2011 14:32:31: B Marktplaats gm.spam2...@gmail.com Odeslal: r-help-boun...@r-project.org 01.07.2011 14:32 Komu r-help@r-project.org Kopie Předmět [R] defining new variable Hello, I'm new to R and I'm trying to define new

[R] Odp: Find the function of a line

2011-06-29 Thread Petr PIKAL
Hi r-help-boun...@r-project.org napsal dne 29.06.2011 11:38:17: Ida Dolciotti ida.dolcio...@ufz.de Hello everybody, I have drawn a line in a x y plot that links the minimum and maximum points in the plot plot(xx,yy) a=max(yy) b=min(yy) lines(c(xx[yy==a],xx[yy==b]),c(a,b))

Re: [R] create a new data frame after comparing two columns of the previous data frame

2011-06-28 Thread Petr PIKAL
Hi r-help-boun...@r-project.org napsal dne 28.06.2011 02:45:01: Right. You forgot the comma! If you want to resolve this rather cryptic advice see ?[ Regards Petr -- David. On Jun 27, 2011, at 7:10 PM, Nanami wrote: it's a table; I read it from a file; I've tried to make it

[R] Odp: data.frame: How to get the classes of all components and how to remove their factor structure?

2011-06-28 Thread Petr PIKAL
Hi Dear expeRts, I have two questions concerning data frames: (1) How can I apply the class function to each component in a data.frame? As you can see below, applying class to each column is not the right approach; applying it to each component seems bulky. (2) After transforming the

[R] Odp: data.frame: How to get the classes of all components and how to remove their factor structure?

2011-06-28 Thread Petr PIKAL
Dear expeRts, I have two questions concerning data frames: (1) How can I apply the class function to each component in a data.frame? As you can see below, applying class to each column is not the right approach; applying it to each component seems bulky. (2) After transforming the

Re: [R] Odp: counting columns that fulfill specific criteria

2011-06-27 Thread Petr PIKAL
Hi r-help-boun...@r-project.org napsal dne 24.06.2011 16:51:27: Thanks for your reply, but that is not quite what I am looking for...I do not want to add up all the values in the row, I want to get the number of columns in each row that meet the criteria and then get that as a

Re: [R] Fastest way of finding if any members of vector x fall in the range of the rows of matrix y

2011-06-24 Thread Petr PIKAL
Hi Hi Dimitris, Thanks for your reply. But this is not exactly what i am after. I want to find the probes that falls into certain regions. In your solution it will ignore the second probe if it falls into the same region as the first one. Is there any vector trickb uilt in R to find

Re: [R] else problem

2011-06-24 Thread Petr PIKAL
Hi Thank you for all your help! I did not know to use when searching for help, as ?mean, etc, had always worked for me in the past. It makes perfect sense why 'else' was causing me the trouble the way I was using it. I think it was working in my other code, despite the same format,

[R] Odp: counting columns that fulfill specific criteria

2011-06-24 Thread Petr PIKAL
Hi Hi, I have a matrix (pwdiff in the example below) with ~48 rows and 780 columns. For each row, I want to get the percentage of columns that have an absolute value above a certain threshold t. I then want to allocate that percentage to matrix 'perc' in the corresponding row.

Re: [R] strange date problem - May 3, 1992 is NA

2011-06-23 Thread Petr PIKAL
Hi r-help-boun...@r-project.org napsal dne 22.06.2011 20:40:39: On 6/22/2011 1:34 PM, Sarah Goslee wrote: On Wed, Jun 22, 2011 at 2:28 PM, David Winsemius dwinsem...@comcast.net wrote: On Jun 22, 2011, at 2:03 PM, Sarah Goslee wrote: Hi, On Wed, Jun 22, 2011 at 11:40 AM,

Re: [R] how to get the miminum value in the list

2011-06-20 Thread Petr PIKAL
Hi r-help-boun...@r-project.org napsal dne 19.06.2011 20:45:04: Hi: It's just an extra step: y - list(list(c(1,5),c(2,3,4)), list(c(1, 3, 4), c(5, 7))) lapply(seq_len(length(y)), function(i) lapply(y[[i]], min)) [[1]] [[1]][[1]] [1] 1 [[1]][[2]] [1] 2 [[2]] [[2]][[1]] [1] 1

[R] Odp: Replace selected columns of a dataframe with NA

2011-06-20 Thread Petr PIKAL
Hi I am using the following command to replace all the missing values and assorted typos in a dataframe with NA: mydata[mydata80]=NA The problem is that the first column contains values which should be more than 80, so really I want to do it just for mydata[,2:length(mydata)] I

Re: [R] Replacing values without looping

2011-06-17 Thread Petr PIKAL
Hi Hi, If you truly have an array, this is option that should be much faster than a loop: index - which(is.na(dat)) dat[index] - dat[index - 1] the only catch is that when there previous value is NA, you may have to go through the process a few times to get them all. One way to

[R] Odp: alphahull: is low level plotting possible?

2011-06-16 Thread Petr PIKAL
Hi Dear R users, I am using package alphahull version 0.2-0 with R-2.13.0. Here is my problem. I have produced a 2-D plot of points and need to draw convex hulls around some subsets of these points. So I just need to add the convex hulls to the already existing plot. That is why I

[R] Odp: problems with plots in loop (corrected Email)

2011-06-15 Thread Petr PIKAL
Hi r-help-boun...@r-project.org napsal dne 14.06.2011 18:28:42: Andreas Betz ab...@portola.com Odeslal: r-help-boun...@r-project.org 14.06.2011 18:28 Komu r-help@r-project.org Kopie Předmět [R] problems with plots in loop (corrected Email) Dear helpers, In an

Re: [R] automatically generate the output name of my for loops

2011-06-13 Thread Petr PIKAL
Hi r-help-boun...@r-project.org napsal dne 13.06.2011 05:21:23: Re: [R] automatically generate the output name of my for loops ?paste something like... paste (group, i, sep=_) I believe that better idea is to use list, with which you can work further much more efficiently. lll-

[R] Odp: How do I make proper use of the by() function?

2011-06-13 Thread Petr PIKAL
Hi [R] How do I make proper use of the by() function? Dear list, I have a function that uses values from two vectors and spits out one new vector based on all the values of the two original vectors, and with the same length as them. Ok, I would now like to be able to apply that

Re: [R] How to create a numeric data.frame

2011-06-13 Thread Petr PIKAL
Hi r-help-boun...@r-project.org napsal dne 13.06.2011 17:19:39: Patrizio Frederic frederic.patri...@gmail.com On Mon, Jun 13, 2011 at 4:45 PM, Barry Rowlingson b.rowling...@lancaster.ac.uk wrote: On Mon, Jun 13, 2011 at 11:06 AM, Aparna aparna.sampat...@gmail.com wrote: Hi All I am

Re: [R] automatically generate the output name of my for loops

2011-06-13 Thread Petr PIKAL
Hi r-help-boun...@r-project.org napsal dne 13.06.2011 17:35:29: jiliguala jiligu...@mail.com really thanks for helping. i just did just like what Petr Pikal said, but it appeared some error like this: There were 50 or more warnings (use warnings() to see the first 50): Warning

[R] Odp: log2() and -min() very quick question

2011-06-13 Thread Petr PIKAL
Hi r-help-boun...@r-project.org napsal dne 13.06.2011 17:59:03: Ben Ganzfried ben.ganzfr...@gmail.com Odeslal: r-help-boun...@r-project.org 13.06.2011 17:59 Komu r-help@r-project.org Kopie Předmět [R] log2() and -min() very quick question I'm looking over good-code a

[R] Odp: what is the mistake?? the coding still not function. no result display

2011-06-10 Thread Petr PIKAL
Hi [R] what is the mistake?? the coding still not function. no result display #lda.r # #Author:Amsha Nahid, Jairus Bowne, Gerard Murray #Purpose:Perform Linear Discriminant Analysis (LDA) # #Input:Data matrix as specified in Data-matrix-format.pdf #

[R] Odp: How to subset based on column name that is a number ?

2011-06-10 Thread Petr PIKAL
Hi [R] How to subset based on column name that is a number ? Hi, I have a data frame with column names 1, 2, 3, ... and I'd like to extract a subset based on the values in the first column. None of the methods I tried worked (below). x - subset(dframe, 1 = = My Text) x -

[R] Odp: RES: Recode numbers

2011-06-03 Thread Petr PIKAL
Hi r-help-boun...@r-project.org napsal dne 01.06.2011 21:10:23: Filipe Leme Botelho filipe.bote...@vpar.com.br Odeslal: r-help-boun...@r-project.org RES: [R] Recode numbers I think this is proper. a - c(1, 2, 3, 3, 4, 4, 5, 6, 1, 2, 2, 3, 1, 2, 1, 2, 3, 3, 4, 5, 1, 2, 3, 4) b -

[R] Odp: Problem using read.xls - Everything converted to factors

2011-06-03 Thread Petr PIKAL
Hi [R] Problem using read.xls - Everything converted to factors Hallo, I would like to use to read.xls function from the gdata package to read data from Microsoft Excel files but I experienced a problem: For example I used the following code:

[R] Odp: conversion of matrix into list

2011-06-01 Thread Petr PIKAL
Hi Dear all, I have a matrix X which consists of 2 columns. I would like to convert this matrix into a list where every entry of the list consists of a single row of the matrix. e.g. split(mat, 1:nrow(mat)) Regards Petr Does anyone have a suggestions how to manage this?

[R] Odp: while loop problems

2011-06-01 Thread Petr PIKAL
Hi Without reproducible example or some code I wonder if anybody can give you some advice. As a wild guess do you use if function correctly i.e. input is length one logical vector ? And maybe you do not need loop at all Regards Petr [R] while loop problems Hi , i am trying to get this

[R] Odp: load seven files (named by date) at a time

2011-06-01 Thread Petr PIKAL
Hi [R] load seven files (named by date) at a time Hello, I'm trying to load a weeks worth of files that are each named by the date they were creaded (e.g., 20110601.RData), starting with the day before today so if today is June 1, I would like to load 20110525- 20110531. The script

[R] Odp: Three sigma rule

2011-05-31 Thread Petr PIKAL
Hi r-help-boun...@r-project.org napsal dne 28.05.2011 20:12:33: Salil Sharma sali...@gmail.com Odeslal: r-help-boun...@r-project.org Dear Sir, I have data, coming from tests, consisting of 300 values. Is there a way in R with which I can confirm this data to 68-95-99.8 rule or

[R] Odp: Using NULL to my data?

2011-05-09 Thread Petr PIKAL
Hi r-help-boun...@r-project.org napsal dne 09.05.2011 16:07:27: Nilza BARROS nilzabar...@gmail.com Odeslal: r-help-boun...@r-project.org 09.05.2011 16:07 Dear R users, I am reading data from a file where there are some missing that are represented by -.00. I am using the

Re: [R] Setting NA to blank

2011-05-09 Thread Petr PIKAL
Hi Re: [R] Setting NA to blank I asked because I thought it'd solve an issue I had. I was actually being quite rash in asking this question and for that, I apologize. I wanted to know because I was attempting to create a heatmap where the NA values would not be shown while all the

[R] Odp: Alter a line in a file.

2011-05-05 Thread Petr PIKAL
Hi r-help-boun...@r-project.org napsal dne 05.05.2011 14:16:04: Joel joda2...@student.uu.se Odeslal: r-help-boun...@r-project.org 05.05.2011 14:16 Hi all R users Ive got a file that contains diffrent settings in the manor of: What file, what is its structure, is it some R object

Re: [R] Alter a line in a file.

2011-05-05 Thread Petr PIKAL
to select the setting? Petr Pikal wrote: What file, what is its structure, is it some R object or separate file? What did you try and what went wrong? Regards Petr Just a normal textfile nothing fancy Ive tried diffrent kind of ways of useing my OS witch is linux by the system

[R] Odp: Is this confict of different versions of R or something else?

2011-05-04 Thread Petr PIKAL
Hi r-help-boun...@r-project.org napsal dne 04.05.2011 12:44:04: TheSavageSam jujok...@jyu.fi Odeslal: r-help-boun...@r-project.org Hello! I have had some problems lately with use of R at home and school. At my home laptop (Ubuntu linux 64bit R-2.12.0) R works just fine. But when I

Re: [R] SAPPLY function XXXX

2011-05-04 Thread Petr PIKAL
Hi r-help-boun...@r-project.org napsal dne 04.05.2011 22:26:59: Erik Iverson er...@ccbr.umn.edu Odeslal: r-help-boun...@r-project.org 04.05.2011 22:26 Komu Dan Abner dan.abne...@gmail.com Ultimately, I would like for this to be 1 conponent in a larger function that will

[R] Odp: for loop with global variables

2011-04-28 Thread Petr PIKAL
Hi r-help-boun...@r-project.org napsal dne 28.04.2011 16:16:16: ivan i.pet...@gmail.com Odeslal: r-help-boun...@r-project.org 28.04.2011 16:16 Komu r-help@r-project.org Kopie Předmět [R] for loop with global variables Hi, is there a possibility to use global variables

Re: [R] for loop with global variables

2011-04-28 Thread Petr PIKAL
Hi r-help-boun...@r-project.org napsal dne 28.04.2011 16:59:26: ivan i.pet...@gmail.com Odeslal: r-help-boun...@r-project.org 28.04.2011 16:59 Komu jim holtman jholt...@gmail.com Kopie r-help@r-project.org Předmět Re: [R] for loop with global variables Hi, thank you

Re: [R] for loop with global variables

2011-04-28 Thread Petr PIKAL
Hi Something like paste(output, i, sep = .) shall work You could consult FAQ 7.34 How can I save the result of each iteration in a loop into a separate file Regards Petr r-help-boun...@r-project.org napsal dne 28.04.2011 17:17:48: Petr PIKAL petr.pi...@precheza.cz Odeslal: r-help-boun

[R] Odp: fast way to compare two matrices

2011-04-27 Thread Petr PIKAL
Hi x - matrix(rnorm(1e6), 1000,1000) y - matrix(rnorm(1e6), 1000,1000) identical(x,y) [1] FALSE The response is almost instant. In case you are not satisfied with the unspecific answer be more specific with your question. Regards Petr r-help-boun...@r-project.org napsal dne 27.04.2011

[R] Odp: calculations with vectors of unequal length

2011-04-27 Thread Petr PIKAL
Hi r-help-boun...@r-project.org napsal dne 27.04.2011 13:30:13: Hi there, this is probably simple but I can't seem to figure it out by myself... I have two dataframes (df.1 and df.2): df.1 - data.frame(year=factor(rep(1:3,3)), level=rep(letters[1:3],3), number=c(11:19)) df.2 -

[R] Odp: read.table: fill=T for header?

2011-04-27 Thread Petr PIKAL
Hi If I understand correctly you maybe could read a file without header, discard last column, read first line of a file and put it as column names. read.delim(textConnection(infile), header=F, skip=1) scan(textConnection(infile), nlines=1, sep=\t, what=c(,)) Regards Petr

Re: [R] Factor function

2011-04-26 Thread Petr PIKAL
Hi d-data.frame(matrix(c(ww,ww,xx,yy,ww,yy,xx,yy,NA), ncol=3, byrow=TRUE)) Change character value NA to missing value NA d[d[,3]==NA,3]-NA If you want drop any unused levels of a factor just use factor(d[,3]) [1] xx yy NA Levels: xx yy Regards Petr r-help-boun...@r-project.org napsal

[R] Odp: ploting continuos function

2011-04-22 Thread Petr PIKAL
Hi r-help-boun...@r-project.org napsal dne 22.04.2011 09:19:19: Hello R, I would like to plot continuos function (e.g. y=x^2) without creating a sequence for x. Is there a possibility to somehow specify the range - x belongs to -100,100? Something like curve(x^2, -100,100) Maybe this

<    1   2   3   4   5   6   7   8   9   10   >