similar to: how to define a function in R

Displaying 20 results from an estimated 1000 matches similar to: "how to define a function in R"

2010 Jul 23
3
Filtering in R
The dataframe is id salary 100 500 101 600 102 700 103 800 how can i generate a subsets if salary>600? -- View this message in context: http://r.789695.n4.nabble.com/Filtering-in-R-tp2299603p2299603.html Sent from the R help mailing list archive at Nabble.com.
2010 Jul 23
1
MISSING VALUE IN R
I have a DF ID VALUE 100 120 101 100 102 100 103 104 105 .... when i calculate the sum of the values, it returned NA. should I populate the blank value as 0? Thanks, -- View this message in context: http://r.789695.n4.nabble.com/MISSING-VALUE-IN-R-tp2299586p2299586.html Sent from the R help mailing list archive at Nabble.com.
2010 Jul 23
1
na.rm=TRUE
POS=sum(x[-1][x[-1]>0],na.rm=TRUE) is this the correct syntax? -- View this message in context: http://r.789695.n4.nabble.com/na-rm-TRUE-tp2299596p2299596.html Sent from the R help mailing list archive at Nabble.com.
2010 Jul 12
2
cbind in for loops
I have 30 files in the current directories, i would like to perform the cbind(fil1,file2,file3,file4....file30) how could i do this in a for loop: such as: file2 <- list.files(pattern=".out3$") for (j in file2) { cbind(j).......how to implement cbind here } Thanks. -- View this message in context:
2010 Aug 03
2
subset based on column names and then subset based on the inverse (grep?, or...)
I would like to be able to grab x and y columns out of a dataframe and then grab all of the columns that are not equal to x or y. I am sure that I am missing something easy. ftbr_UTM_downstream <- (structure(list(site = c("Jennie_Creek_Main_Stem", "Wolf_Pit_Creek_Main_Stem", "Little_Rockfish_Main_Stem_North", "Big_Muddy_Creek_Main_Stem",
2010 Jul 19
3
invalid type error
>myDF = data.frame(id=c("A10","A20"),d1=c(.3,.3),d2=c(.4,.4),d3=c(-.2,.5),d4=c(-.3,.6),d5=c(.5,-.2),d6=c(.6,-.4),d7=c(-.9,-.5),d8=c(-.8,-.6)) >doit=function(x)c(x[1],sum_LK_positive=sum(x[-1][x[-1]>0]),sum_LK_negative=sum(x[-1][x[-1]<0])) > myDF id d1 d2 d3 d4 d5 d6 d7 d8 1 A10 0.3 0.4 -0.2 -0.3 0.5 0.6 -0.9 -0.8 2 A20 0.3 0.4 0.5 0.6 -0.2
2011 Mar 31
2
Linear Model with curve fitting parameter?
I have a model Q=K*A*(R^r)*(S^s) A, R, and S are data I have and K is a curve fitting parameter. I have linearized as log(Q)=log(K)+log(A)+r*log(R)+s*log(S) I have taken the log of the data that I have and this is the model formula without the K part lm(Q~offset(A)+R+S, data=x) What is the formula that I should use? Thanks for all of your help. I can provide a subset of data if necessary.
2013 May 01
3
Chron format question h:m not working
R 2.12.2 on Scientific Linux 6.4 #works chron(times.="15:00:00", format=c(times="h:m:s")) #doesn't work chron(times.="15:00", format=c(times="h:m")) From chron Manual: The times format can be any permutation of "h", "m", and "s" separated by any one non-special character. The default is "h:m:s". what am I
2011 Apr 16
2
(no subject)
I have just upgraded to R 2.13 and have library(ggplot2) in my .Rprofile (among other things). when i start R I get an error message. Has something in the start up scripts changed? Is there a better way to specify the library calls in .Rprofile? Thanks for all of the help in advance. Error: Loading required package: grid Loading required package: proto Error in rename(x, .base_to_ggplot) :
2010 Sep 08
1
problem with max in a function
s <- 1.00 max(s) returns 1 is there anyway that I can get it to return 1.00. I am using the results of this max statement in a grep statement and it returns the wrong numbers, I will provide more information and code if it would make more sense in context. -- Stephen Sefick ____________________________________ | Auburn University? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?? | | Department of
2012 Jul 18
1
ggplot2 qplot pch not working anymore
Is there a way to use a continuous variable to pch in qplot? I believe this worked in previous version. I need to specify certain values of a shape for particular points so that multiple graphs all show the same shapes for the same streams. I have gone to the original data and added a pch column that I would like to use to specify the shapes to pch in qplot. Any help would be greatly
2012 Nov 16
2
source file on startup question - why does an old version of a function show up? ggplot or R?
All, 1. I will try and make this clear and concise. Please let me know any information that would be helpful in figuring out this problem (I don't know the relevant information to post). I am on linux- see below for session information. 2. Problem: working directory: home an old version of a function is sourced into the R session and doesn't work working directory: Desktop the
2010 Jul 22
5
choosing a random sample by precentage
hi all i have found the follwoing way to choose a random sample by sample size (200): ten_per_T2000 <- F_T2000_All[sample(nrow(F_T2000_All), 200), ] but i wondered if there is a way to choose a sample size by precentage (10% etc..) thx ethan
2010 Jul 22
2
p-VALUE calculation
Here is my dataframe with 1000 rows: employee_id weigth p-value 100 150 101 200 102 300 103 180 ..... My question: how can I calculate the p-value in R for each employee? the distribution of the weigth will be established from the above 1000 samples. -- View this message in context:
2010 Jul 07
3
how to process this in R
Here are what i am going to accomplish: I have 400 files named as xxx.txt. the content of the file looks like the following: name count 1. aaa 100 2. bbb 2000 3. ccc 300 4. ddd 3000 ........ more that 1000 rows in each files. these are the areas i need help: 1. how can i only read in the files with the string patterns ggg or fff as part of the file names? for
2010 Jul 27
4
re-sampling of large sacle data
myDF: d1 d2 d3 d4 d5 -0.166910351 0.022304377 -0.00825924 0.008330689 -0.000925938 -0.166910351 0.022304377 -0.00825924 0.008330689 -0.000925938 -0.166910351 0.022304377 -0.00825924 0.008330689 -0.168225938 -0.166910351 0.022304377 -0.00825924 0.008330689 -0.168225938 -0.166910351 0.022304377 -0.00825924 0.008330689 -0.168225938 -0.166910351
2010 Jul 15
1
loess line predicting number where the line crosses zero twice
These data represent stream channel cross-sectional surveys. I would like to be able to find the measurement on the tape (measure) where the Bank Full Depth (bkf_depths) is 0. This will happen twice because the channel has two sides. I thought fitting a loess line to these data and then predicting the measurment number would do it. I was wrong. Below is my failed attempt. My naive thought is
2010 Jun 29
3
formating chron date times for printing
the date were created with chron with this argument format=c(dates="Y/m/d", times="H:M:S")) so I have the dates being displayed as (10/06/22 12:00:00) I would like to have them displayed as "2010-06-22 12:00:00" or "%Y-%m-%d %H:%M:%S" and then I can convert these for mergeing with another data frame x <- (structure(c(14464, 14464.0104166667,
2010 Jun 29
1
How to allocate more memories to R?
When I use this I am getting following warning at the time of opening R from that shortcut : "-max-mem-size=2048MB:too large and taken as 2047M" Why I am getting this? I have 3GB ram installed and using within Vista. Thanks -- View this message in context: http://r.789695.n4.nabble.com/How-to-allocate-more-memories-to-R-tp2271714p2272436.html Sent from the R help mailing list archive
2010 Sep 03
2
Package wavelets
Hi user's Does anybody work with wavelets on R? Please I need some help.....!!!! Atte Marize Sim?es -- View this message in context: http://r.789695.n4.nabble.com/Package-wavelets-tp2526023p2526023.html Sent from the R help mailing list archive at Nabble.com.