Re: [R] Merging and subsetting with row names XXXX

2012-01-04 Thread Petr PIKAL
Hi As you did not provide any data you probably can not get canned solution Hello everyone, I have two questions: 1) I want to create a subset of a data frame column-wise and simultaneously extract the row names into a proper variable. I tried this, but received an error:

Re: [R] Adding a vertical line to plot with two overlapping density plots

2012-01-04 Thread Petr PIKAL
:55, Petr PIKAL petr.pi...@precheza.cz wrote: Hi Hi, A simple question I hope. I wish to add a single vertical line to a plot with several density plots. Here is a simplified example. thedata - data.frame(x1=rnorm(100,1,1),x2=rnorm(100,3,1)) #create data thedata.m

Re: [R] problem in R

2012-01-03 Thread Petr PIKAL
Hi hello sir, i m a student of bioinformatics,i hv a problem in R, i want to do correlation analysis of microarray data,hw can i ignore the NA value for the calculation or correlation.this is a very large data n many empty fields they giving me NA values of correlation,wat i

Re: [R] summary per group

2012-01-02 Thread Petr PIKAL
Hi Hello, I know that it'll be quite easy to do what I want but somehow I am lost as I am new to R. I want to get summary results arranged by groups. In detail I'd like get the number (levels) of Species per Family like for this dataset: SPEC - factor(c(a,a,b,b,c,c,c,d,e,e,e,e))

Re: [R] summary per group

2012-01-02 Thread Petr PIKAL
Hi Hi Hello, I know that it'll be quite easy to do what I want but somehow I am lost as I am new to R. I want to get summary results arranged by groups. In detail I'd like get the number (levels) of Species per Family like for this dataset: SPEC -

Re: [R] convert variable types when creating data frame from cor.test results

2011-12-28 Thread Petr PIKAL
Hi Dear list, The below dataset and code creates a new dataset with the results from the function cor.test being performed on each individual ('Individual_ID') from my original dataset. How do I convert each variable from the cor.test results to a numeric data type, as it is passed into

Re: [R] Help with code

2011-12-26 Thread Petr PIKAL
Hi Can you explain rules for propagating values? I do not see any pattern. Only when there is no Y in a line you want to fill all columns with either T1D_noc or Ctrl_noc based on t1d_ptype. I would start with narrowing the levels in last column as it seems to me there is no difference between

Re: [R] Search a string inside a data.frame

2011-12-21 Thread Petr PIKAL
Hi Dear all, I have a string and I want to search for its existance inside a data.frame (or in a column of the data.frame). One way is for me to do this manually: Make a for loop for the number of elements and compare one by one element. Is there though any more improved way to do

[R] Odp: Creating and assigning variable names in loop

2011-12-21 Thread Petr PIKAL
Hi You probably want this cycle for some reason but if you know how many labels you want you just can label - paste(score, 1:3, sep=_) label [1] score_1 score_2 score_3 Then instead of assigning names in a cycle you can label-c(names(samp_data), label) for( i in 1:3) { samp_data -

Re: [R] Help with code

2011-12-21 Thread Petr PIKAL
Hi I do not know how to use dput, i am attaching the txt file for the data dput(any.object) puts a structure of this object to console. You can copy it to your email and anybody can copy it back to R. Or you can transfer the structure to file see ?dput, ?dget

Re: [R] fractal image analysis

2011-12-20 Thread Petr PIKAL
regards, Andrés AM * * 2011/12/19 Sarah Goslee sarah.goslee_at_gmail.com Hi, I've always used FRAGSTATS, but it looks like the SDMTools package will do it within R. Sarah On Mon, Dec 19, 2011 at 4:56 AM, Petr PIKAL petr.pikal_at_precheza.cz wrote: Dear all

Re: [R] Help with code

2011-12-20 Thread Petr PIKAL
Hi hello gurus, i have a data frame like this HTN HTN_FDR Dyslipidemia CAD t1d_ptype[1:25] 1Y YY T1D 2 T1D 3 Ctrl_FDR 4 T1D

[R] fractal image analysis

2011-12-19 Thread Petr PIKAL
Dear all I tried to find some packages (or programs) for image analysis and especially fractal dimension image analysis but so far I had not success. It shall be used for particle surface layer analysis from TEM images. Any suggestions? Best regards Petr

[R] Odp: Dealing with NAs

2011-12-18 Thread Petr PIKAL
Hi Without knowing details about mlogit and without any data from your side to check I guess that you shall put na.omit or na.exclude instead of na.pass to na.action Regards Petr Ville Iiskola ville.iisk...@uta.fi Odeslal: r-help-boun...@r-project.org 18.12.2011 15:06 Komu

Re: [R] package.skeleton()

2011-12-18 Thread Petr PIKAL
Hi If I remember correctly I do start clear R -vanilla session copy my functions to it. run package.skeleton(some.name) which creates the some.name directory. Regards Petr Hi Duncan, Thanks for your response. That's the confusing thing, I didn't receive a message and I can't seem to

[R] Odp: Multiple plots in one subplot

2011-12-16 Thread Petr PIKAL
Hi Hi, I making a figure with six sub-plots using par(mfcol=c(2,3)). In the last sub-plot I want to have two graphs instead of one. I have tried using par(fig=x,y,z,v) but this par seems to overwrite the first par. Is there a simple solution? You can try ?layout or grid graphic. This

Re: [R] modify the name of axis of an R function

2011-12-15 Thread Petr PIKAL
Hi Thanks you very much! The way plot(fit, main=main title, xlab=X-axis lable, ylab=y-axis label) seems to work quite well, I didn't notice that I could do this. I have in fact one more problem with it : the fact is that I have three plots that are called by the function. I can

[R] Odp: Problem with package compilation

2011-12-15 Thread Petr PIKAL
Hi Hi, I have a R package with some functions made all of then only with R code. I use the command R CMD build to build a package that I can install on linux, windows or mac, because all the code is only R code. But I have some problems with R version. For each new R version I need

Re: [R] shorter way of coding

2011-12-12 Thread Petr PIKAL
Hi Dear R users, I am using the code below to generate a fitted value of b. I have about 300 different values for for y (y1, y2, ...y300) which means I will have to write the code below 300 times to generate the 300 different fitted values for y. Is there a short way of doing that ?

Re: [R] question about spaces in r

2011-12-11 Thread Petr PIKAL
Hi First of all, it's R, not r, and on this mailing list people care about this kind of thing. Second, you will need to provide more information in order to get better help. Please read the posting guide. There are a number of introductory level documents available via CRAN, please

Re: [R] read.table performance

2011-12-09 Thread Petr PIKAL
09:32, Petr PIKAL wrote: Hi system.time(dat-read.table(test2.txt)) user system elapsed 32.380.00 32.40 system.time(dat - read.table('test2.txt', nrows=-1, sep='\t', header=TRUE)) user system elapsed 32.300.03 32.36 Couldn't.it be a Windows issue? Likely - here

Re: [R] what is the difference between using function predict() and coef() in prediction

2011-12-09 Thread Petr PIKAL
Hi Did you find any difference? The results shall be same (with only rounding error). Can you show us some example where you get substantial difference? Regards Petr i do not know what is the difference between predict() and coef() i use the two function give me different result zz =

Re: [R] read.table performance

2011-12-08 Thread Petr PIKAL
Hi system.time(dat-read.table(test2.txt)) user system elapsed 32.380.00 32.40 system.time(dat - read.table('test2.txt', nrows=-1, sep='\t', header=TRUE)) user system elapsed 32.300.03 32.36 Couldn't.it be a Windows issue? _ platform

Re: [R] Help to get fitted and residual value

2011-12-07 Thread Petr PIKAL
Hi Hei, i) get names of object returned by lm(). in this case fit names(fit) output from command : names(fit) [1] coefficients residuals effects rank [5] fitted.values assignqrdf.residual [9] contrasts xlevels call

Re: [R] Data alignment

2011-12-05 Thread Petr PIKAL
Re: [R] Data alignment Thanks for your suggestions. I will try them. The - in my original post was actually only there to serve as a separator so that it is easier for you to see the data structure but apparently it rather confused you... sorry :) That is why dput is to be used. Try

Re: [R] problem merging data with different shapes

2011-12-05 Thread Petr PIKAL
Hi I have been trying to merge datasets, one of which has a long format (Adata) and one has a (different) long format (Bdata): Adata Bdata subject order bpm subject order trial agegroup gender 1 1 70.21 1

[R] Odp: R code

2011-12-01 Thread Petr PIKAL
Hi Hi everybody, I am unable to resolve this error using the following for loop. Would appreciate help. The same loop works with for(i in 1:92) strangely. I checked the .raw input file and everything is kosher, even Line 547 mentioned in the error message. I wonder if there is any

Re: [R] how to transform a data file

2011-11-29 Thread Petr PIKAL
Hi option 3 library(reshape) melt(d, id.vars=id) Regards Petr Hi PJ, Try # some data id - 1:20 m - matrix(sample(0:1, 200, TRUE), ncol = 10) colnames(m) - paste('V', 1:10, sep = ) d - data.frame(id, m) d # option 1 cbind(rep(d$id, each = ncol(d)-1), matrix(unlist(t(d[,-1])),

Re: [R] Transforming a string into a command

2011-11-29 Thread Petr PIKAL
On Nov 29, 2011, at 2:00 AM, Xu Wang wrote: Why don't the following two commands work? eval(parse(text=s)) eval(as.expression(s)) Hm, try to set an object s before calling. Regards Petr __ R-help@r-project.org mailing list

Re: [R] Transforming a string into a command

2011-11-29 Thread Petr PIKAL
Hi Did my reply get orphaned or are you trying to help me realize that asking why something does not work is not a straightforward question? I'll try to cover both bases. I'll focus just on the first case that I don't understand. Suppose we have s- ln(a+b) a-1 b-2

Re: [R] assigning multiple outputs

2011-11-18 Thread Petr PIKAL
Hi Hi All, So I figured out how to do multiple outputs, but whats the best/ recommended way of assigning them. f-function{a=1; b=1; list(a,b)} I get an error f-function{a=1; b=1; list(a,b)} Error: unexpected '{' in f-function{ and I wonder what do you want. f- function(a=1, b=1) {

Re: [R] Need Help

2011-11-18 Thread Petr PIKAL
Hi, I need to make a subset of my species abundance matrix with only species (columns) that have a total abundance(column sum) greater than 0.5 to do ordination in vegan package. I used following code but it is not working. Can you please give me a solution. gl1-

Re: [R] Adding a year to existing date

2011-11-17 Thread Petr PIKAL
Hi On 17/11/11 17:33, arunkumar wrote: Hi I need to add an year to and date field in the dataframe. Please help me X Date 1 2008-01-01 2 2008-02-01 3 2003-03-01 I can't find anything built in. This is probably because year is an ill-defined unit; years vary in

Re: [R] help in fitted values in lm function

2011-11-14 Thread Petr PIKAL
Hi Hi, I have a data set of 1 rows and ran a linear regression by using the function lmres = lm(formula,data) then got the fitted value by using the value fit=fitted(lmres). but the number of rows in the fitted one is about 9548, What could be the reason for reduction in the

[R] regular expression for selection

2011-11-14 Thread Petr PIKAL
Dear all I am again (as usual) lost in regular expression use for selection. Here are my data: dput(mena) c(138516_10g_50ml_50c_250utes1_m53.00-_s1.imp, 138516_10g_50ml_50c_250utes1_m54.00_s1.imp, 138516_10g_50ml_50c_250utes1_m55.00_s1.imp, 138516_10g_50ml_50c_250utes1_m56.00_s1.imp,

Re: [R] regular expression for selection

2011-11-14 Thread Petr PIKAL
Hi Hi, Try grepl instead of sub, mena[grepl(m5., mena)] It does not select those m5? strings from those character vectors. I need as an output a vector m53, m54, m55, m56, m57, m58, m59 Regards Petr HTH, baptiste On 14 November 2011 21:45, Petr PIKAL petr.pi...@precheza.cz

Re: [R] regular expression for selection

2011-11-14 Thread Petr PIKAL
Hi On 11/14/2011 07:45 PM, Petr PIKAL wrote: Dear all I am again (as usual) lost in regular expression use for selection. Here are my data: dput(mena) c(138516_10g_50ml_50c_250utes1_m53.00-_s1.imp, 138516_10g_50ml_50c_250utes1_m54.00_s1.imp

Re: [R] regular expression for selection

2011-11-14 Thread Petr PIKAL
value. This evaluation is returned by backreference. Is it correct evaluation? Regards Petr On 14.11.2011 10:22, Petr PIKAL wrote: Hi On 11/14/2011 07:45 PM, Petr PIKAL wrote: Dear all I am again (as usual) lost in regular expression use for selection. Here are my data: dput

Re: [R] Help with text separation

2011-11-14 Thread Petr PIKAL
Hi r-help-boun...@r-project.org napsal dne 14.11.2011 14:54:05: Thank you Sarah, Your reply was very helpful. I have the added difficulty that I am not only dealing with single A-Z characters, but quite often have the following situation:

Re: [R] Odp: Error in matrix, not ordered vectors or numerical value, and SIAR.

2011-11-13 Thread Petr PIKAL
Hi Hello Petr, The demo's don't run either, with the same errors. In that case you shall contact the package maintainer and in a meantime you could try to debug the function yourself if you are in desperate need for the result. Petr Thanks for your help. Best wishes. --

Re: [R] With an example - Re: rbind.data.frame drops attributes for factor variables

2011-11-13 Thread Petr PIKAL
dataset[ nrow(dataset), ] - c (Male, 5, bad) The above seems to have worked to append a row in place of a rbind(). This No. It overwrites your last row. You maybe meant dataset[ nrow(dataset)+1, ] - c (Male, 5, bad) Regards Petr method does not drop the custom attributes from the

Re: [R] Odp: Error in matrix, not ordered vectors or numerical value, and SIAR.

2011-11-11 Thread Petr PIKAL
Re: [R] Odp: Error in matrix, not ordered vectors or numerical value, and SIAR. Thank-you Petr. I have consulted as many manuals and help pages, and search engines, and trying various things in SIAR, but continuous errors prevail.. I have tried changing all matrices to numeric,

Re: [R] Web based R-help not a list

2011-11-10 Thread Petr PIKAL
On Nov 9, 2011, at 5:38 PM, Cem Girit wrote: Hello, Is there a web version of this R-Help user group snip Yes. You were offered an option to get a digest when you signed up. I'm not sure if this response answers the question. It seems to me that there

Re: [R] Error in Summary.factor(c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 4L, : max not meaningful for factors

2011-11-10 Thread Petr PIKAL
Hi Thanks Duncan. This is a package, SIAR. fo - ordered(f) fo [1] a b c d e Levels: a b c d e max(fo) [1] e Levels: a b c d e The data set has 101 values, what can I use instead of letters? Why do you need to use letters? AFAIK this was only illustration

Re: [R] Upgrade R?

2011-11-10 Thread Petr PIKAL
Hi Since apparently there is no one familiar with this error message let me rephrase the question. Is there a 'manual' process to fully remove a version of 'R' from my machine? This is a Window PC running Windows 7. Not sure about W7 but I can easily remove R installation by simple

[R] Odp: Error in matrix, not ordered vectors or numerical value, and SIAR.

2011-11-10 Thread Petr PIKAL
Hi Help! model1 - siarmcmcdirichletv4(data, source, tef, concdep=0, 50, 5) Error in matrix(1, ncol = (numsources + numiso) * numgroups, nrow = (siardata$iterations - : invalid 'ncol' value (too large or NA) In addition: Warning message: In Ops.ordered((numsources +

Re: [R] How to delete only those rows in a dataframe in which all records are missing

2011-11-07 Thread Petr PIKAL
Perhaps something like this will work. df[!(rowSums(is.na(df))==NCOL(df)),] Or df[complete.cases(df),] Regards Petr Michael On Fri, Nov 4, 2011 at 9:27 AM, Jose Iparraguirre jose.iparragui...@ageuk.org.uk wrote: Hi, Imagine I have the following data frame: a -

Re: [R] How to delete only those rows in a dataframe in which all records are missing

2011-11-07 Thread Petr PIKAL
)), ] Cheers, Dennis 2011/11/7 Petr PIKAL petr.pi...@precheza.cz: Perhaps something like this will work. df[!(rowSums(is.na(df))==NCOL(df)),] Or df[complete.cases(df),] Regards Petr Michael On Fri, Nov 4, 2011 at 9:27 AM, Jose Iparraguirre jose.iparragui

Re: [R] merging two dataframes

2011-10-26 Thread Petr PIKAL
Hello. Now i tried to do what you told me. I used the str(fuction), and data$date1 and data3$date1 where both listed You have no date1 only date. Therefore result- merge(data, data3, by=c(date, name), all=T) takes all values from both data frames dim(data) [1] 20 15 dim(data3) [1]

Re: [R] merging two dataframes

2011-10-26 Thread Petr PIKAL
Re: [R] merging two dataframes I pasted wrong function, I have changed from date1 to date (ignore that). I think it have to be something wrong with my data format. I can`t understand why it don't work. I know I can use by.x= and by.y=, but since both datasets have the same

Re: [R] How to create a new variable based on parts of another character variable.

2011-10-24 Thread Petr PIKAL
Hi If you want to get rid of regular expressions at all and your A values start AWI for Arctic and UFT for boreal you can DF$D - ifelse(substr(DF$A, 1,1) == A, Arctic, Boreal) Regards Petr Hello, I am just starting with R and I am having a (most probably) stupid problem by creating a

Re: [R] merging two dataframes

2011-10-24 Thread Petr PIKAL
Hi Hello I am a new user of R and I need help to merge two large datasets about stocks with different number of rows and columns. Both have 2 variable(column) that are have same values (name and date1), but they are not in same order and data3 contains much more observations. In the

Re: [R] How to create a new variable based on parts of another character variable: A generalization

2011-10-24 Thread Petr PIKAL
, which tends to get dissed a lot, because it can badly burn you if you're not careful with it. A fuller discussion of these issues can be found by searching onassociative arrays or hashes, of which factors are an elementary example. -- Bert On Mon, Oct 24, 2011 at 6:00 AM, Petr

Re: [R] merging two dataframes

2011-10-24 Thread Petr PIKAL
Thank you Petr! I have read on the merge help page, but I cant figure out how to write this function. When I use your function it includes all data from data3, but all columns in data has NA(without name and date. I hoped to keep these values Because name and date common columns and

Re: [R] cut data into sevral group and assign calculated values individually

2011-10-19 Thread Petr PIKAL
Hm Not much of an example. You can cut your m according to breaks cc - cut(m, c(0,331,476, 608, 791, 900)) [1] (0,331] (331,476] (476,608] (608,791] (791,900] NA Levels: (0,331] (331,476] (476,608] (608,791] (791,900] You can add NA as an extra level by factor(cc, exclude=NULL) [1] (0,331]

Re: [R] Repeat a loop until...

2011-10-19 Thread Petr PIKAL
Hi I may be completely off track without knowing mnormt package but what about using while loop for counting rows in correct datamat. #first set your matrix datamat - rmnorm(n=1500,mean=c(mean(sanad[,1]),mean(sanad[,2]),mean(sanad[,3])),varcov=covmat) #get rid of out of spec values datamat -

Re: [R] Length of data.frame column

2011-10-14 Thread Petr PIKAL
Hi I have a related question...I have a data frame similar with 74 rows that I created with header=TRUE, but when I try to coerce one of the data frame columns into a vector, it shows up as having length 1, even though when I print it, it shows 74 elements: VAL - c(DailyDiary[1])

Re: [R] Problem executing function

2011-10-12 Thread Petr PIKAL
Hi Michael, Thanks for the reply, but still the problem exists. When I list the objects and return the result, they get printed on the console but the objects do not get created. I am really baffled and clueless as to what the problem is. I bet you do not understand basic operations

Re: [R] Mean or mode imputation fro missing values

2011-10-12 Thread Petr PIKAL
Hi Yes thank you Gu… I am just trying to do this as a rough step and will try other imputation methods which are more appropriate later. I am just learning R, and was trying to do the for loop and f-statement by hand but something is going wrong… This is what I have until now:

[R] Odp: labels in a boxplot

2011-10-12 Thread Petr PIKAL
Dear R-listers, I have a little problem with a boxplot and I hope you can help me figuring it out. I'll try to make up some data to illustrate the issue. Sorry, if my procedures look naive, but these are my first steps in R. Any comments and/or suggestions are very welcome. let's

Re: [R] Comparing the components of a data frame without levels interfering

2011-10-12 Thread Petr PIKAL
Hi *Bottom Line: How can I compare the individual components of two data frames with different row lengths without the levels interfering?* Example: I have two data frames to those respectively named 'dfCity' and 'dfState' that have the following output: dfCity Name City

[R] Odp: Superposing mean line to xyplot

2011-10-11 Thread Petr PIKAL
Hi Dear R-users, I'm using lattice package and function xyplot for the first time so you will excuse me for my inexperience. I'm facing quite a simple problem but I'm having troubles on how to solve it, I've read tons of old mails in the archives and looked at some slides from Deepayan

[R] Odp: help with statistics in R - how to measure the effect of users in groups

2011-10-10 Thread Petr PIKAL
Hi I do not understand much about your equations. I think you shall look to Practical Regression and Anova Using R from J.Faraway. Having data frame DF with columns - users, groups, results you could do fit - lm(results~groups, data = DF) Regards Petr Hi, I'm a newbie to R. My

Re: [R] help with statistics in R - how to measure the effect of users in groups

2011-10-10 Thread Petr PIKAL
data. Regards Petr On Mon, Oct 10, 2011 at 9:32 AM, Petr PIKAL petr.pi...@precheza.cz wrote: Hi I do not understand much about your equations. I think you shall look to Practical Regression and Anova Using R from J.Faraway. Having data frame DF with columns - users, groups

Re: [R] help with statistics in R - how to measure the effect of users in groups

2011-10-10 Thread Petr PIKAL
, Petr PIKAL petr.pi...@precheza.cz wrote: Hi Petr, It's not an equation. It's my mistake; the * are meant to be field separators for the example data. I should have just use blank spaces as follows: users Group1 Group2 Group3 u110 5N/A u2

Re: [R] help with statistics in R - how to measure the effect of users in groups

2011-10-10 Thread Petr PIKAL
Gawesh On Mon, Oct 10, 2011 at 11:17 AM, Petr PIKAL petr.pi...@precheza.cz wrote: Hi Petr, It's not an equation. It's my mistake; the * are meant to be field separators for the example data. I should have just use blank spaces as follows

Re: [R] Mean(s) from values in different row?

2011-10-07 Thread Petr PIKAL
Hi Hello: Is there a way to get a mean from values stored in different rows? The data looks like this: YEAR-1, JAN, FEB, ..., DEC YEAR-2, JAN, FEB, ..., DEC YEAR-3, JAN, FEB, ..., DEC What I want is the mean(s) for just the consecutive winter months: YEAR-1.DEC,

Re: [R] Unexpected behavior of extract (`[`) or sapply functions

2011-10-07 Thread Petr PIKAL
Hi Is it necessary to use sapply? With lapply you will get what you want. Regards Petr Dear folks-- The function below is a snippet of a larger function that is not doing what it is supposed to do, and I do not understand its behavior. The larger function is supposed to produce an

[R] Odp: accumulate vector data

2011-10-07 Thread Petr PIKAL
Hi ?cumsum Regards Petr Hi, What is the best way to accumulate the entries in a vector. For example, a - c(1,2,3,4,5) And I want to have b - c(1,3,6,10,15) Best, Karl [[alternative HTML version deleted]]

Re: [R] How to subset() from data frame using specific rows

2011-10-05 Thread Petr PIKAL
On Tue, 4 Oct 2011, Sarah Goslee wrote: You asked for pointers, and didn't provide a reproducible example, so I offered a pointer. Sarah, I did not realize that your pointer was to the factor component of the subset() command. I think the most parsimonious thing for me

[R] Odp: repeating categorical variable codes

2011-10-05 Thread Petr PIKAL
Hi I would appreciate help in knowing how to repeat categorical variable code given in column=A, by the number in a matching column=B. For example, I have a categorical variable code attributed to a household=A and want to replicate the code for all member of the household, as given in

Re: [R] How to subset() from data frame using specific rows

2011-10-05 Thread Petr PIKAL
Hi On Wed, 5 Oct 2011, Petr PIKAL wrote: Hm. I seldom use such approach. In your original request you said you want split your data to smaller data frames based on sites Petr, I need the additional information in the database, too. But you do not loose them, your data frame

Re: [R] repeating categorical variable codes

2011-10-05 Thread Petr PIKAL
Ric On 5 October 2011 23:44, Petr PIKAL petr.pi...@precheza.cz wrote: Hi I would appreciate help in knowing how to repeat categorical variable code given in column=A, by the number in a matching column=B. For example, I have a categorical variable code attributed to a household

Re: [R] Matching two datasets and updating values

2011-10-04 Thread Petr PIKAL
Hi Dear R forum I have two datafarmes with category and cat_val forming one dataframe and cust and cust_category forming another dataframe. category = c(C, D, B, A) cat_val = c(0.10, 0.25, 0.40, 0.54) cust = c(cust_1, cust_2, cust_3, cust_4, cust_5, cust_6, cust_7, cust_8, cust_9,

Re: [R] Help with cast/reshape

2011-10-03 Thread Petr PIKAL
Hi I realize that this is terribly basic, but I just don't seem to see it at this moment, so I would very much appreciate your help. How shall I transform this dataframe: df1 Name Index Value 1a 1 0.1 2a 2 0.2 3a 3 0.3 4a 4 0.4 5b

Re: [R] Interaction plot type=o

2011-09-30 Thread Petr PIKAL
David, thank you for your reply I tried this attach(mtcars) interaction.plot(cyl, gear, mpg, type=o, pch=5:8, lty=1 ) but I got this error: Error in match.arg(type) : 'arg' should be one of l, p, b and in ?interaction.plot, o it is not listed in type arguments. Is there any other

Re: [R] regression with ordered arguments

2011-09-29 Thread Petr PIKAL
recommend to read R - Inferno from Patrick Burns Regards Petr f. On 27 September 2011 14:20, Petr PIKAL petr.pi...@precheza.cz wrote: Hi Francesco Dear Petr, thank you so much for your quick reply. I was sure that there were some smart ways to address my issue. I went through

[R] Odp: create loops in the explanatory variables using lm

2011-09-29 Thread Petr PIKAL
Hi Well, are those names (Acer_davidii, ...) columns in data frame? If not and you want them as factors of species you shall reformat your input so as you get data frame with columns mortality, richness, species, community. Column species shall have your plant species names in each respective

Re: [R] create loops in the explanatory variables using lm

2011-09-29 Thread Petr PIKAL
+ bb + cc + aa + comun But as I said I am not sure if this is sensible from statistical point of view. Somebody more capable than me has to resolve it. It seems to me that you will get the same result in each call of lm Regards Petr thanks a lot david Am 29.09.2011 um 11:57 schrieb Petr

[R] Odp: regression with ordered arguments

2011-09-27 Thread Petr PIKAL
Hi Dear R listers, I am trying to be a new R user, but life is not that easy. My problem is the following one: let's assume to have 3 outcome variables (y1, y2, y3) and 3 explanatory ones (x1, x2, x3). How can I run the following three separate regressions without having to repeat the lm

Re: [R] regression with ordered arguments

2011-09-27 Thread Petr PIKAL
(function(x,y) lm(y~x), xxx, yyy, SIMPLIFY=F) you can see structure of any object by str(mmm) Both results shall be similar, for this case I believe that for loop is easier to understand. Regards Petr Thank you very much for your precious support, f. On 27 September 2011 10:08, Petr PIKAL

Re: [R] Boxplot BUT with Mean, SD, Max Min ?

2011-09-26 Thread Petr PIKAL
Gabor, Bill, On 2011-09-27 02:51, Gabor Grothendieck wrote: On Mon, Sep 26, 2011 at 12:11 PM, Philip Rhoades p...@pricom.com.au wrote: Gabor, On 2011-09-27 00:35, Gabor Grothendieck wrote: On Mon, Sep 26, 2011 at 9:56 AM, Philip Rhoades p...@pricom.com.au wrote:

Re: [R] need help on melt/cast

2011-09-23 Thread Petr PIKAL
Hi I can never remember what melt, cast and all that means, hence I simpy use reshape() which does not even require any additional package: reshape(dat, direction=long, idvar = ID, varying=list(2:4), v.names=Value, times=names(dat)[2:4]) Uwe Ligges www ID T0 T1 T2 1 A 1 2 3

[R] Odp: Newbie question: Converting Table

2011-09-23 Thread Petr PIKAL
[R] Newbie question: Converting Table Hi, I'm new to R, and I have searched helpfiles and this forum on my 2 questions. Hope you guys can help me out! :-) You did not search enough. You probably want table or xtabs Q1 untested res - xtabs(~subject+class, data=your.file) ifelse(res==1,

[R] comparing factor and value data (rather offtopic)

2011-09-23 Thread Petr PIKAL
Dear all I have a bit off topic question. I need to compare some measured values with people's subjective estimation (was not done yet). Before I start the experiment I would like to consult some appropriate literature. Basically I will have several samples and several people can evaluate all

Re: [R] Problem with converting factors to numbers

2011-09-20 Thread Petr PIKAL
Hi [R] Problem with converting factors to numbers Hi all, I have a very simple problem, but i cant find a solution probably because i search for the wrong keywords. I have coordinates x and y. They look like this: str(data) 'data.frame': 13979 obs. of 2 variables: $ x

[R] Odp: means across list of data frames

2011-09-20 Thread Petr PIKAL
Hi I have a list of data frames like the following: set.seed(123) a- data.frame(x=runif(10), y = runif(10), sample = seq(1,10)) b- data.frame(x=runif(10), y = runif(10), sample = seq(1,10)) L- list(a,b) All data frames in the list have the same dimensions. I need to calculate the

Re: [R] Replacing matching values by related values

2011-09-19 Thread Petr PIKAL
Hi Works for me, how did you tested it? v - sample(letters[1:10], 17, replace=T) d-data.frame(letters[1:10], 1:10) d[match(v,d[,1]),2] [1] 8 2 6 1 7 10 4 10 10 9 10 8 1 8 6 7 8 Regards Petr Předmět Re: [R] Replacing matching values by related values Thanks Michael. I

Re: [R] function to include factors in summary data frame

2011-09-14 Thread Petr PIKAL
Hi all, I have a dataframe that includes data on individuals that are distributed across multiple rows. I have aggregated the data using ddply, but I have columns in the original data frame that are factors ( such as sites A, B, and C) that I would like to include in the new data

[R] Odp: Moving data in a dataset

2011-09-14 Thread Petr PIKAL
Hi [R] Moving data in a dataset Dear all, i'm relatively new to R and so my question could be considered stupid.. By the way.. I have a dataset and i would like to move data from a cell to another specific cell. Hw can i do?? What is cell? And how do you want to move data? BTW.

Re: [R] I cannot load my workspace in R

2011-09-14 Thread Petr PIKAL
Hi Re: [R] I cannot load my workspace in R It would not load that file, it just stopped there. I do not believe that. Anyway, if R stop to respond to your commands you probably has broken installation. What type of file you are trying to load? Is it saved workspace? Any errors. Here is

Re: [R] Factors? I think?

2011-09-09 Thread Petr PIKAL
Hi Isn't it something for merge is designed? merge(Doctors, DeptCodes, by.x=DocDepts, by.y=Depts) DocDeptsDocs DeptNames 1 Christian\nChristianson Heart 2 Bob Smith Brain 3 Greg Jones Anesthesia 4

Re: [R] problems with function read.table

2011-09-09 Thread Petr PIKAL
Hi Hi, If you read carefully the help pages for read.table you get this: na.stringsa character vector of strings which are to be interpreted as NA../../utils/help/NA values. Blank fields are also considered to be missing values in logical, integer, numeric and complex fields.

Re: [R] problems with function read.table

2011-09-09 Thread Petr PIKAL
: Petr PIKAL [mailto:petr.pi...@precheza.cz] Gesendet: Freitag, 9. September 2011 09:23 An: Carlos Ortega Cc: Samir Benzerfa; r-help@r-project.org Betreff: Re: [R] problems with function read.table Hi Hi, If you read carefully the help pages for read.table you get

Re: [R] access objects

2011-09-08 Thread Petr PIKAL
Hi Beware of shooting in your leg. Instead of poisoning your workspace with numerous objects called obj.n or something like that you help yourself with creating single object of type list. Parts of a list can be accessed much more easily than this kind of get construction. I use R quite a

Re: [R] Extract r.squared using cbind in lm

2011-09-08 Thread Petr PIKAL
Hi Hello, I am using cbind in a lm-model. For standard lm-models the r.squared can be easily extracted with summary(model)$r.squared, but that is not working in in the case with cbind. Here an example to illustrate the problem: a - c(1,3,5,2,5,3,1,6,7,2,3,2,6) b -

Re: [R] subsetting tables

2011-09-07 Thread Petr PIKAL
Hi Hi Eik, greetings to Hamburg! :-) Thanks for the fast and helpful answer Eik Vettorazzi-2 wrote: #compare str(red[,2]) str(red[2,]) I understand that the first is a real vector of nums in R and the second is a ?? matrix/list/data.frame ?? of single ? entries? Can I

Re: [R] two question about plot

2011-09-02 Thread Petr PIKAL
Hi Re: [R] two question about plot The help for boxplot offers suggestions for both those things. You may be particularly interested in: names: group labels which will be printed under each boxplot. Can be a character vector or an expression (see plotmath). add:

Re: [R] !!!function to do the knn!!!

2011-09-01 Thread Petr PIKAL
Hi Try to call 112 if you are in Europe. Regards Petr Re: [R] !!!function to do the knn!!! help, help ,help!!! -- View this message in context: http://r.789695.n4.nabble.com/function-to- do-the-knn-tp3781137p3781738.html Sent from the R help mailing list archive at Nabble.com.

Re: [R] convert to grid file

2011-09-01 Thread Petr PIKAL
Hi Hi I computed probability in each cell. I have: [99883,] -0.0062412957690 [99884,] -0.0062412957690 [99885,] -0.0062412957690 [99886,] -0.0062412957690 [99887,] -0.0062412957690 [99888,] -0.0062412957690 [99889,] 0.9909126638948 [99890,] 0.9909126638948 [99891,]

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