[R] Apply Function to Columns

2014-10-23 Thread Sarah
also considering to use the function « lapply », but I don’t think I can use it in this case, isn’t it? Thank you very much for your help ! Sarah __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read t

Re: [R] Apply Function to Columns

2014-10-24 Thread Sarah
> Le 24 oct. 2014 à 09:23, Sarah a écrit : > > Thank you very much, it helped a lot! > > I just have another question know. I want to make plot for every species. I > just add the function « plot correlog » to the previous function and I have > now

[R] Incorrect number of dimensions

2009-12-05 Thread Sarah
I am trying to fit a linear model with seasonal effects but keep getting 'Incorrect number of dimensions'. I have no idea what this means or how to fix it. I am following instructions received from an instructor and it worked for him, so I assume it has something to do with my data. Here is my

[R] Simulating data, loop

2010-10-29 Thread Sarah
Hello, I would like to run a script in which a loop is included. Since I'm new to R, I cannot manage the following problem. I really hope someone could help me out. Data in the variable Y should be removed from the simulated data set with probability 0.50 if the variable X has a value below zero

[R] Simulating data and imputation

2010-12-29 Thread Sarah
, there are no NA's to impute) Does anyone knows how to rewrite the last bit of the script (if...else...-part), in order to keep the 6 'deleted/missing' values in the data set, and give them a value mar.y=1 (or NA, or any other value), together with the 34 'observed ones' (mar

[R] dataframe, simulating data

2010-12-31 Thread Sarah
a larger design, I have to stick to this example.) Hope someone has an answer. Wishing you a very happy 2011, Sarah. -- View this message in context: http://r.789695.n4.nabble.com/dataframe-simulating-data-tp3169246p3169246.html Sent from the R help mailing li

Re: [R] dataframe, simulating data

2010-12-31 Thread Sarah
),34-length(which(df$mar.y==0, ] } while 40 cases are needed. Thanks for your replies. Sarah. -- View this message in context: http://r.789695.n4.nabble.com/dataframe-simulating-data-tp3169246p3169354.html Sent from the R help mailing list archive at Nabble.com. __

Re: [R] dataframe, simulating data

2011-01-02 Thread Sarah
Thanks, Petr! With your script my problem is solved. David, thanks for your help and time as well!! I really appreciate it. -- View this message in context: http://r.789695.n4.nabble.com/dataframe-simulating-data-tp3169246p3170764.html Sent from the R help mailing list archive at Nabble.com. _

[R] multiple imputation manually

2011-02-07 Thread Sarah
Hi, I want to impute the missing values in my data set multiple times, and then combine the results (like multiple imputation, but manually) to get a mean of the parameter(s) from the multiple imputations. Does anyone know how to do this? I have the following script: y1 <- rnorm(20,0,3) y2 <- rn

Re: [R] multiple imputation manually

2011-02-09 Thread Sarah
Hi Daisey, Thanks for your answer! You've mentioned to change the name of the dataset. Is it possible to rename the data set with each run (so read in the incomplete dataset, do the imputation, and call it dataset 1; read in the (same) incomplete dataset, do another imputation, and call it datase

[R] Calculating mean from wit mice (multiple imputation)

2011-07-20 Thread Sarah
Hi all, How can I calculate the mean from several imputed data sets with the package mice? I know you can estimate regression parameters with, for example, lm and subsequently pool those parameters to get a point estimate using functions included in mice. But if I want to calculate the mean value

[R] Multiple imputation on subgroups

2011-10-10 Thread Sarah
Dear R-users, I want to multiple impute missing scores, but only for a few subgroups in my data (variable 'subgroups': only impute for subgroups 2 and 3). Does anyone knows how to do this in MICE? This is my script for the multiple imputation: imp <- mice(data, m=20, predictorMatrix=pred, post=p

Re: [R] convertTime package.

2017-10-31 Thread Sarah Goslee
le to suggest a work-around for a function of unknown purpose and origin. (The posting guide for this list suggests you include all of that information when you inquire.) Sarah On Tue, Oct 31, 2017 at 2:04 PM, Scott Anderwald via R-help wrote: > To whom it might concern. I am working on a

Re: [R] How to produce rainfall maps

2017-11-21 Thread Sarah Goslee
rting with? What kind of maps do you want to produce? Sarah On Fri, Nov 17, 2017 at 3:40 AM, Stefano Sofia wrote: > Dear R users, > I need to produce rainfall maps using R. > I know that this is possible, I looked though the web, I found the example > below reported (the author is A

Re: [R] Need Guidance

2017-12-01 Thread Sarah Goslee
for this act of kindness. > > Best Wishes > Ali Hassan Shabbir -- Sarah Goslee http://www.functionaldiversity.org __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do

Re: [R] problem with the behaviour of dashed lines in R plots

2017-12-04 Thread Sarah Goslee
1.431341 -14.10790 20 1.425015 -14.06372 If instead you use abline(regressor, lty=2) you will get a nice-looking dashed line. Or, if you want only the data extent, you could use just the points for the minimum and maximum values of x. Sarah On Mon, Dec 4, 2017 at 12:13 PM, jean-philippe wrote: > d

Re: [R] Perform mantel test on subset of distance matrix

2018-01-18 Thread Sarah Goslee
Hi Andrew, Yes, you cannot have NA values in your matrices. Instead, you could incorporate a model matrix. See Legendre, P. & Fortin, M.J. Vegetatio (1989) 80: 107. https://doi.org/10.1007/BF00048036 for ideas. Sarah On Sun, Dec 31, 2017 at 12:55 PM, Andrew Marx wrote: > I'm tryin

Re: [R] how to search r-help?

2018-01-19 Thread Sarah Goslee
gestions. Nabble is another good choice, and simply entering "r > > [topic]" in a search engine will usually yield hundreds of results. > > > > __ > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see &

Re: [R] length of 'dimnames' [2] not equal to array extent- For Correlation Plot

2018-03-17 Thread Sarah Goslee
assign the result to anything: as.matrix() does not work in place. CR1 <- as.matrix(CR1) Now try. If that doesn't work, then provide a reproducible example so we can offer further advice. Sarah On Sat, Mar 17, 2018 at 11:08 AM, Shivi Bhatia wrote: > Created a new data set with 3 numer

Re: [R] length of 'dimnames' [2] not equal to array extent- For Correlation Plot

2018-03-17 Thread Sarah Goslee
tcars) M <- cor(mtcars) corrplot(M) Sarah On Sat, Mar 17, 2018 at 12:00 PM Shivi Bhatia wrote: > Hi Sarah, > Thank you for your help. > > I tried using CR1<-as.matrix(CR1) but gives error Error in corrplot(CR1, > method = "circle") : The matrix is not in [-1, 1]!. I

Re: [R] Plot data in sequence

2018-04-04 Thread Sarah Goslee
", "13141", "13142", "14151", "14152")) > levels(datn$STATUS) [1] "ENTRY" "11121" "11122" "12131" "12132" "13141" "13142" "14151" "14152" Reorder the levels to

Re: [R] Gantt Chart Using Plotrix

2018-04-22 Thread Sarah Goslee
t, then use dput(abc) to provide a reproducible example, and submit that to the list. We can't tell the format of the various columns from a copy and paste. Sarah On Sun, Apr 22, 2018 at 6:10 PM, wrote: > From the help file for plotrix: > " ... x - a list of task labels, st

Re: [R] Gantt Chart Using Plotrix

2018-04-23 Thread Sarah Goslee
ing about, because it is looking for particular names. If you fix those problems, it works fine. colnames(cdfg) <- c("labels", "starts", "ends") cdfg$labels <- as.character(cdfg$labels) gantt.chart(cdfg) Sarah On Sun, Apr 22, 2018 at 7:50 PM, wrote: &g

Re: [R] Fill down a new column in data frame with a number

2018-05-10 Thread Sarah Goslee
tput to look like, please provide more information. Sarah On Thu, May 10, 2018 at 9:04 AM, Marcelo Mariano Silva wrote: > Hi, > > I am a begginer in R programming. > > I am traying to create a a column in my data frame filled down with a > number. > >> df$newcolumn <- num

Re: [R] add one variable to a data frame

2018-05-11 Thread Sarah Goslee
way using rle() dat1$C2 <- rep(seq_len(length(unique(dat1$B))), times=rle(as.vector(dat1$B))$lengths) (That second will work even if B is a factor.) > dat1 N B C1 C2 1 1 29_log 1 1 2 2 29_log 1 1 3 3 29_log 1 1 4 4 27_cat 2 2 5 5 27_cat 2 2 6 6 1_log 3 3 7

Re: [R] par(mfrow=c(3,4)) problem

2018-05-30 Thread Sarah Goslee
Hi, You're mixing base plot and ggplot2 grid graphics, which as you've discovered doesn't work. Here's av strategy that does: https://cran.r-project.org/web/packages/egg/vignettes/Ecosystem.html This vignette has a good overview, well as info specific to that package. Sa

Re: [R] internet routines cannot be loaded, R 3.5.0

2018-06-06 Thread Sarah Goslee
/mirmon_report.html#us Pick a different mirror, and it should work. Sarah On Wed, Jun 6, 2018 at 12:27 PM, LMH wrote: > Hello, > > I recently upgraded my version of R and find I need to reinstall packages > (unless there is some method to import my old profile and files). I have set > m

Re: [R] open help files from Terminal

2018-06-07 Thread Sarah Goslee
Here are two options: > # for one occurrence > help("help", help_type="html") starting httpd help server ... done > > # to set the default for your R session > options(help_type = "html") > ?help If you read the help file for help(), you will

Re: [R] compiling functions....

2018-06-21 Thread Sarah Goslee
ed through profiling and careful thought: 3 days to 3 seconds, even. Sarah On Thu, Jun 21, 2018 at 6:28 AM, akshay kulkarni wrote: > dear members, > I a Day Trader based in INDIA. I use R for my > research. I have a function ygusa(snlq,snlcqn) which takes 208 stoc

Re: [R] Convert list of data frames to one data frame

2018-06-29 Thread Sarah Goslee
; bind_rows(lapply(employees4BList, function(x) rbind.data.frame(c(t(x) > > # This produces a nice list of data frames, except for the names > > lapply(employees4BList, function(x) rbind.data.frame(c(t(x > > # This list is a disaster. I am looking for a solution that wor

Re: [R] "igraph0" package installation

2018-07-05 Thread Sarah Goslee
've posted. https://stackoverflow.com/questions/48255675/subgraphmining-package-not-available Or, ideally, convince the book author to upgrade the package to use igraph. Sarah On Thu, Jul 5, 2018 at 2:01 PM, Maryam R via R-help wrote: > Hi, I’m maryam that ask question about "igraph0&q

Re: [R] pull stat out of summary

2017-03-31 Thread Sarah Goslee
The short answer is that hold isn't a list-like object, and $ only works with list-like objects (lists and data frames, mainly). You can get the full explanation (VERY full), at ?Extract or any of its aliases, like ?'$' or ?'[' Sarah On Fri, Mar 31, 2017 at 7

Re: [R] Creating interactive graphs and exporting to Intranet site

2017-04-23 Thread Sarah Goslee
resulting html file is copied to the server. It sounds like exactly what you need. Sarah On Sat, Apr 22, 2017 at 10:29 PM, Chris Battiston wrote: > Good evening, > > I’m relatively new to using R and am trying to find a way to create a series > of interconnected graphs where I h

Re: [R] visualization of KNN results in text classification

2017-05-08 Thread Sarah Goslee
are after. Sarah On Mon, May 8, 2017 at 9:21 AM Elahe chalabi via R-help < r-help@r-project.org> wrote: > Any idea?! > > On Sunday, May 7, 2017 5:56 PM, Elahe chalabi via R-help < > r-help@r-project.org> wrote: > > > Hi all, > > Does anyone know what is

Re: [R] organizing data in a matrix avoiding loop

2017-05-26 Thread Sarah Goslee
There are various ways to do this. It shouldn't take forever as a loop, with only 215 entries. I find crosstab() from the ecodist package helpful. The current version is on GitHub, but not yet CRAN (soon!). Sarah On Fri, May 26, 2017 at 7:47 AM A M Lavezzi wrote: > Dear R-Users &g

[R] plspm package error in data frame

2017-06-11 Thread Sarah Sinasac
undefined columns selected I would really appreciate if anyone could provide advice on how to correct this error. I am using the plspm package in order to analyze my data for my masters thesis at the University of Waterloo. Thank you! Sarah __

Re: [R] Help to organize data

2017-06-25 Thread Sarah Goslee
This is pretty badly mangled (please don't post in html), but ?aggregate is probably what you want. Sarah On Sun, Jun 25, 2017 at 5:27 PM, Jackson Rodrigues wrote: > Hi everybody, > > My name is Jackson and come here ask for a help to organize data. > I really need help from yo

Re: [R] Predict

2017-06-30 Thread Sarah Goslee
my questions have to do with what your objective actually is, like what you are modeling and what you are doing with the predictions. But my sample code might be enough to get you headed in the right direction regardless. Sarah On Fri, Jun 30, 2017 at 9:27 AM, Ahmed Attia wrote: > Hi folks, > &g

Re: [R] Predict

2017-06-30 Thread Sarah Goslee
Once again, you are over-writing your variable. This time, you are overwriting the entirety of Stand_Height with the timeseries of height. Perhaps you should spend some time with one of the good introductory R resources out there, and think a bit more about your procedure. Sarah On Fri, Jun 30

Re: [R] error with subtree()

2017-09-09 Thread Sarah Goslee
You appear to already have something named subtree in your environment: The following object is masked _by_ ‘.GlobalEnv’: subtree You could get rid of it, or you could specify that you want to use subtree from extracat hcs <- extracat::subtree(hc, k = 7) Sarah On Sat, Sep 9, 2017 at 8

[R] Fortune candidate: Re: Whether statistical background is must to learn R language

2016-05-31 Thread Sarah Goslee
On Tue, May 31, 2016 at 11:09 AM, Jeff Newmiller wrote: > > > However, please don't apply R like a magic answers box, because you can > mislead others and cause harm. __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.eth

Re: [R] Struggling trying to plot points on boxplot

2016-06-02 Thread Sarah Goslee
pch=2) Notice that even though the boxplot labels are 4, 9, 15 the plot coordinates are 1, 2, 3. Sarah On Thu, Jun 2, 2016 at 11:36 AM, Thomas Adams wrote: > Hello all: > > I've been beating my head on this for over a day and I have done a lot of > Google'ing with no luck.

Re: [R] Fw: i need to install "Rclimdex"........Senior Scientists , BARI

2016-06-05 Thread Sarah Goslee
maintainers. Sarah On Sun, Jun 5, 2016 at 5:23 AM, Ranjit Sen via R-help wrote: > > > > Dear Sir: > This is Dr Ranjit Sen, Senior Scientific Officer, Soil Science Division, > Bangladesh Agricultural Research Institute(BARI). For my research on climatic > variability

Re: [R] performance of do.call("rbind")

2016-06-27 Thread Sarah Goslee
ction(x)testdf) > > system.time(r.df <- do.call("rbind", testdf.list)) user system elapsed 195.105 36.419 231.930 > > system.time({ + testm.list <- lapply(testdf.list, as.matrix) + r.m <- do.call("rbind", testm.list) + }) user system elapsed 0.603

Re: [R] performance of do.call("rbind")

2016-06-27 Thread Sarah Goslee
clude packages beyond the base functionality). In general, though, using matrices is faster than using data frames, and using do.call is faster than using a pre-allocated loop, which is much faster than growing an object. Sarah > testsize <- 5000 > > set.seed(1234) > testdf <- data.frame(mat

Re: [R] performance of do.call("rbind")

2016-06-28 Thread Sarah Goslee
On Mon, Jun 27, 2016 at 11:34 PM, Jeff Newmiller wrote: > Sarah, you make it sound as though everyone should be using matrices, even > though they have distinct disadvantages for many types of analysis. I'm saying that if you don't need the special features of a data frame, man

Re: [R] Can I increase the size of an asterisk in plotmath()?

2016-06-30 Thread Sarah Goslee
#x27;s suggestion text(2, 3, expression(paste(bolditalic(p)^"*"))) # repeat Rolf's original text(locator(1), "*", cex=3) # click on the asterisk: how big do you want it? Sarah On Thu, Jun 30, 2016 at 4:46 AM, Rolf Turner wrote: > On 30/06/16 19:38, Göra

Re: [R] Column product

2016-07-01 Thread Sarah Goslee
47916 169344 421824 889056 1687500 Sarah On Fri, Jul 1, 2016 at 10:15 AM, Steven Yen wrote: > A is a 5 x 3 matrix and a is a 3-vector. I like to exponentiate A[,1] to > a[1], A[,2] to a[2], and A[,3] to a[3], and obtain the product of the > resulting columns, as in line 3. > &g

Re: [R] Script/function/procedure with loop

2016-07-11 Thread Sarah Goslee
","text A5","text A6","text > A7","text A8") > varB = c("link B1","link B2","link B3","link B4","link B5","link B6","link > B7","link B8") > df = data.fram

Re: [R] about smwrgraphs package

2016-07-11 Thread Sarah Goslee
le to help with specific questions even if we've never used a particular package. Sarah On Mon, Jul 11, 2016 at 4:47 PM, lily li wrote: > I still haven't heard back from anyone. Please let me know as I think it is > better to discuss here. > > On Sun, Jul 10, 2016 at 1:25 P

Re: [R] Error:'subscript out of bounds'

2016-07-12 Thread Sarah Goslee
ls like dim() and str() until I found the problem. There are more fully-developed debugging tools available, but for such a short function I wouldn't bother. Sarah On Tue, Jul 12, 2016 at 9:29 AM, Samsad Afrin Himi wrote: > Dear R-team, > > I have written this code for calculatio

Re: [R] scatter3D and colours

2016-07-14 Thread Sarah Goslee
ting colvar to your chosen levels gives you the result you expect. Thanks for the complete reproducible example. I wouldn't have even looked at your problem without something to test. Sarah On Thu, Jul 14, 2016 at 1:55 PM, Jorge I Velez wrote: > Dear R-help, > > I am using the plot3

Re: [R] How to group by and get distinct rows of of grouped rows based on certain criteria

2016-07-14 Thread Sarah Goslee
ot;EQ", "AU", "AV", "AW", "AC", "AY", "EQ")), .Names = c("ATP.Group", "Business.Event", "Category"), class = "data.frame", row.names = c(NA, -9L)) hasEQ <- subset(mydat, Category == "EQ&

Re: [R] how to stop interpretation in system()

2016-07-21 Thread Sarah Goslee
md 'ab' > instead of > cmd 'a\tb' > > How can I prevent system to interpret 'a\tb' to 'ab'? > > > Thanks -- Sarah Goslee http://www.functionaldiversity.org __ R-help@r-project.org ma

Re: [R] Reducing execution time

2016-07-27 Thread Sarah Goslee
Hi, It's really a good idea to use dput() or some other reproducible way to provide data. I had to guess as to what your data looked like. It appears that order doesn't matter? Given than, here's one approach: combs <- structure(list(V1 = c(65L, 77L, 55L, 23L, 34L), V2 = c(23L, 34L, 34L, 77L, 6

Re: [R] Reducing execution time

2016-07-27 Thread Sarah Goslee
Rhelp have to guess. Because we tend to guess in ways that make the most sense after extensive R experience, and that's probably not what you have. Sarah On Wed, Jul 27, 2016 at 1:29 PM, sri vathsan wrote: > Hi, > > Thanks for the solution. But I am afraid that after running this co

Re: [R] Fuzzy variable universe

2016-07-28 Thread Sarah Goslee
arning and plot(teste2) makes me think this did what you wanted. At least, it did something. Sarah On Thu, Jul 28, 2016 at 2:11 PM, Arthur Rodrigues Stilben wrote: > Sorry, I forgot to mention: > >> install.packages("sets") > ... >> library(sets) >> teste = fuzz

Re: [R] Fuzzy variable universe

2016-07-28 Thread Sarah Goslee
On Thu, Jul 28, 2016 at 2:46 PM, Arthur Rodrigues Stilben wrote: > > > Em 28-07-2016 15:45, Arthur Rodrigues Stilben escreveu: >> >> Sarah, >> >> First of all, thanks for reply. >> >> Second, It really works, but in fact I would to like t

Re: [R] Fuzzy_partition with fuzzy_trapezoid

2016-08-02 Thread Sarah Goslee
As already discussed, yes, but you can't specify corners and height twice in a single call. Please do read the help for the functions you're interested in, and perhaps go back to refresh yourself on some basic R. > sets_options("universe", seq(from = 0, to = 10, by = 0.1)) > test1 = fuzzy_variable

Re: [R] [R Survey Analysis] Problem counting number of responses

2016-08-16 Thread Sarah Goslee
vector with subset() to get the population that answered all of your questions. The advantage of this approach is that you don't have to list each question individually, in case you have lots. Sarah On Tue, Aug 16, 2016 at 2:51 PM, Lauren Bolger wrote: > M > y dataset includes a survey comp

Re: [R] Replicate

2016-08-23 Thread Sarah Goslee
make sense, then you should definitely go read some of the great introductory material on R out there. Sarah On Tue, Aug 23, 2016 at 1:54 PM, André Luis Neves wrote: > Hi, There! > > I have this data frame: > >> plotdat2 > FirmicutesLowerUpper fTissue2 > 1 63.480

Re: [R] question about cleaning up data labels on a plot3d plot

2016-08-24 Thread Sarah Goslee
0) z <- rnorm(10) + atan2(x, y) # version one: text only plot3d(x, y, z, type="n") text3d(x, y, z, text=letters[1:10], cex=2) # version two: colored symbols data.groups <- sample(1:3, size=10, replace=TRUE) data.colors <- c("red", "purple", "blue")

Re: [R] question about cleaning up data labels on a plot3d plot

2016-08-24 Thread Sarah Goslee
You could take a look at ?identify3d You should probably also read https://cran.r-project.org/web/packages/rgl/vignettes/rgl.html Beyond that, if it's difficult to see what you're looking for, maybe you should rethink your approach. Sarah On Wed, Aug 24, 2016 at 1:21 PM, LMH wrot

Re: [R] possible error in stem() function?

2016-08-29 Thread Sarah Goslee
The help isn't particularly helpful, but you need to play with the scale argument. The range of your first dataset is long enough that you're getting only even-numbered stems by default. Try these: x1 <- c(479,482,487,493,494,494,495,496,497,498,498,499,503,504,507,507,508, 510,511,512,514,516,

Re: [R] source() does not include added code

2016-08-31 Thread Sarah Goslee
If it doesn't do ANYTHING, you may have failed to save the file. Unless that file contains a function, in which case it isn't supposed to do anything except load the function into your global environment. But it should have thrown an error in that case, as Duncan said. On Wed, Aug 31, 2016 at 11:

Re: [R] Same code on Mac?

2016-09-01 Thread Sarah Goslee
on Mac. All of the OS problems I've run into tend to be problems with Windows. It's a bit harder to get some geospatial stuff working on Mac, but that's unlikely to be a problem with your elementary stats students. Sarah -- Sarah Goslee http://www.functionaldiversity.org _

Re: [R] Same code on Mac?

2016-09-01 Thread Sarah Goslee
un on other systems. Sarah On Thu, Sep 1, 2016 at 11:34 AM, Franklin Bretschneider wrote: > Dear Tom Mosca, > > Re: > >> Using a PC I have written the R code for my elementary statistics students. >> One of the students has a Mac. Should the same lines of code work on

Re: [R] (no subject)

2016-09-06 Thread Sarah Goslee
t; cleanBetweenBrackets(Str) [1] "The cat is crazy " The trailing space is left as an exercise for the reader. Sarah On Tue, Sep 6, 2016 at 2:56 AM, Audrey Riddell wrote: > Hello, > > > I am trying to remove brackets and the text contained in brackets. I tried &g

Re: [R] how to manage missing values correctly when importing a data frame

2016-09-07 Thread Sarah Goslee
> > $Station_RM > [1] "integer" > > $Sensor_RM > [1] "integer" > > $Place_RM > [1] "character" > > $Y_init_RM > [1] "integer" > > $M_init_RM > [1] "integer" > > $D_

Re: [R] how to manage missing values correctly when importing a data frame

2016-09-07 Thread Sarah Goslee
> # lets the user decide how to handle the missing data, rather than making > # assumptions. > > Again, sorry for my question > Stefano > > > Da: Sarah Goslee [sarah.gos...@gmail.com] > Inviato: mercoledì 7 settembre 2016 15.11 > A:

Re: [R] understanding with

2016-09-09 Thread Sarah Goslee
ent withoutdata? Obviously I am missing thepoint. My own created > function makes a new environment, but I onlycreated it to crunch numbers. If > it doesn't crunch numbers it's useless. The point is, I do not understand the > definitionof "with" and thus have no ide

Re: [R] understanding with

2016-09-09 Thread Sarah Goslee
Hi Carl, The duplicate names were to demonstrate the difference in search path and environment, since you appeared to be confused. If you dislike with, don't use it. On Fri, Sep 9, 2016 at 5:20 PM, Carl Sutton wrote: > Hi Sarah > > I see the difference, but pardon the big ya

[R] Help with PCA data file prep and R code

2016-09-20 Thread Sarah Stinson
data that contain NA values (pcaMethods), but wasn't able to get the code to work... (I understand that this isn't strictly an R question, but any help would be appreciated.) 2. Does my code look correct for the PCA and visualization (see below)? Thanks in advance, Sarah #rea

Re: [R] Why removing the (Intercept) from lm is done by adding -1?

2016-09-21 Thread Sarah Goslee
re it says "The - operator removes the specified terms". Sarah On Wed, Sep 21, 2016 at 10:19 AM, mviljamaa wrote: > So I found out that to remove the (Intercept) term from lm's model one can > add -1 to the predictors. I.e. do lm(resp ~ x1 + x2 - 1) > > Another way is

Re: [R] Help with PCA data file prep and R code

2016-09-21 Thread Sarah Stinson
caMethods), but wasn't able to get the code to work... (I understand that this isn't strictly an R question, but any help would be appreciated.) 2. Does my code look correct for the PCA and visualization (see below)? Thanks in advance, Sarah #read data mesocleaned <- read.csv("Meso

Re: [R] R-package (“SeCuredSurv”)

2016-09-27 Thread Sarah Goslee
The only google hit appears to be that paper, which is a 2014 PhD dissertation, and states that the author will be uploading it on CRAN. Since that hasn't been done, the only thing you can do is try to track down the author and ask. Sarah On Tue, Sep 27, 2016 at 4:45 AM, stud1830153714

Re: [R] R: Idea behind .First() vs. ~/.Rprofile

2015-04-17 Thread Sarah Goslee
or constructing packages. Though on linux, I use a local .Rprofile if I need per-session options, because I often don't have a saved .RData file. Sarah -- Sarah Goslee http://www.stringpage.com http://www.sarahgoslee.com http://www.functionaldiversity.o

Re: [R] project.org help mailing list the same as ethz.ch mailing list?

2015-04-17 Thread Sarah Goslee
ng list as r-help_AT_stat.math.ethz.ch. > > Are these different mailing lists? They are the same. r-help@r-project.org is the preferred address, but the mailserver is run out of stat.ethz.ch. Sarah Useful info > __ > R-help@r-project

Re: [R] Problem with col

2015-04-20 Thread Sarah Goslee
down. Sarah On Mon, Apr 20, 2015 at 12:33 PM, Sonia Amin wrote: > Dear All, > > I have written the following lines: > > > data<-read.table("C:\\Users\\intel\\Documents\\SIIID\\datamultiplereg.txt",header > = FALSE, sep = "") > colnames(d

Re: [R] Problem with col

2015-04-20 Thread Sarah Goslee
On Mon, Apr 20, 2015 at 12:56 PM, Sonia Amin wrote: > Sorry Sarah for my basic question: what does "a column was read as factor" > mean? A factor is one of the basic types of data in R, and in statistics generally, eg M/F or red/white/blue - a predetermined set of categories tha

Re: [R] Count

2015-05-13 Thread Sarah Goslee
0,0,1,0,0), Camp3 = c(0,1,0,1,0)) aggregate(rowSums(testdata[, -1] == 0), list(testdata$EmpSize), FUN="sum") -- Sarah Goslee http://www.functionaldiversity.org __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.

Re: [R] Counting consecutive events in R

2015-05-14 Thread Sarah Goslee
data$Type_Desc), 1, 0) test1.rle <- rle(test1) test0.rle <- rle(test0) if(any(test1.rle$lengths >= 5 & test1.rle$values == 1)) cat("Type_high\n") if(any(test0.rle$lengths >= 5 & test0.rle$values == 1)) cat("Type_low\n")

Re: [R] Reading a tiff image

2015-05-14 Thread Sarah Goslee
ussions of that very topic on this mailing list, and other useful information. Sarah On Thu, May 14, 2015 at 6:50 AM, Preethi Balaji wrote: > Dear R users, > > I am new to R and trying to learn raster image processing in R. > > I have a tiff image with pixel values and I am trying

Re: [R] Help on Histogram ~ Barplot

2015-05-28 Thread Sarah Goslee
tp://cyclismo.org/tutorial/R/ Sarah -- Sarah Goslee http://www.functionaldiversity.org __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-projec

Re: [R] Help on R Functionality & Histogram

2015-05-29 Thread Sarah Goslee
;, ylim = c(0,9000), cex.axis=0.6, xaxt="n") axis(1, (0:23)+.5, 1:24, cex.axis=.6) text((0:23)+.5, aaa.hist$counts-150, aaa.hist$counts, cex=.6) Sarah -- Sarah Goslee http://www.functionaldiversity.org __ R-help@r-project.org mailing lis

Re: [R] Converting unique strings to unique numbers

2015-05-29 Thread Sarah Goslee
16 4 4 4 10 17 5 5 1 8 18 6 6 1 12 26 head(ids4) id v1 v2 v3 1 1 1 2 8 2 2 2 19 22 3 3 3 21 16 4 4 4 10 17 5 5 1 8 18 6 6 1 12 26 Kate, if you're getting all zeros, check str(yourdataframe) - it's likely that when you imported your data into R the strings were alre

Re: [R] about transforming a data.frame

2015-05-29 Thread Sarah Goslee
s? That is, what is the result you expect to obtain for the sample data you provided? What code have you tried? I would think table() might be involved, and possibly strsplit(), but will refrain from putting more time into this until you provide a reproducible dataset with dput() and some clearer i

Re: [R] about transforming a data.frame

2015-05-29 Thread Sarah Goslee
1111 411 0000 510 0000 > On Fri, May 29, 2015 at 4:58 PM, Bogdan Tanasa wrote: > Hi Sarah, > > thank you for your help. I have simplified the example, by read

Re: [R] about transforming a data.frame

2015-05-29 Thread Sarah Goslee
LMGTFY: http://stackoverflow.com/questions/11433432/importing-multiple-csv-files-into-r On Fri, May 29, 2015 at 5:58 PM, Bogdan Tanasa wrote: > Dear Sarah, > > thank you very much, it is very helpful. please may I ask one more question > about a quick and easy tutorial about

Re: [R] lapply function

2015-05-30 Thread Sarah Goslee
ems to work on the first element of the vector. > > I.E. > scale > function(x,mn,max){ > if (x==min(x)) 0 > > if (x==max(x)) 10 > else x=max-min/10 > } > > where x is the numeric column of the dataframe. > > Thank you. > > > --

Re: [R] Colour gradient is not working.

2015-06-02 Thread Sarah Goslee
the code you used, and some clear idea of what output you expect, it's impossible to figure out how to help you. Here are some suggestions for creating a good reproducible example: http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example Sarah On Tue, Jun 2, 2015 a

Re: [R] Adding columns to a 2D vector

2015-06-03 Thread Sarah Goslee
The first line tells you that your matrix is numeric (matrices can only contain elements of one type), that it has 64 rows and 6 columns, and a bit of what the contents look like. The second line tells you that your matrix has as attributes a list of two dimnames, and the subsequent lines tell yo

Re: [R] Help to solve an Error

2015-06-04 Thread Sarah Goslee
The dangers of HTML: > should be > a greater than symbol. grecent <- subset(gtemp, subset = Year >= 1995,select = c(Year, Annual)) I've copied Gavin so he can decide whether to fix it. Sarah On Thursday, June 4, 2015, Jackson Rodrigues wrote: > Hi, > > > > I

Re: [R] Blank spaces are replaced by period in read.csv, I want to replace blacks with an underline

2015-06-08 Thread Sarah Goslee
Easiest? Use sub() to replace the periods after the fact. You can also use the check.names or the col.names arguments to read.table() to customize your import. Sarah On Mon, Jun 8, 2015 at 10:15 AM, John Sorkin wrote: > I am reading a csv file. The column headers have spaces in them.

Re: [R] Blank spaces are replaced by period in read.csv, I want to replace blacks with an underline

2015-06-08 Thread Sarah Goslee
I've taken the liberty of copying this back to the list, so that others can participate in or benefit from the discussion. On Mon, Jun 8, 2015 at 10:49 AM, John Sorkin wrote: > Sarah, > I am not sure how I use check.names to replace every space in the names of > my variables wit

Re: [R] reading as date

2015-06-10 Thread Sarah Goslee
ame format with % that is > > >> dd<-c("21/01 11:11:11") >> strptime(dd,"%d/%m H:M:S") > [1] NA > > > it is giving NA. > > > -- Sarah Goslee http://www.functionaldiversity.org __ R-help@r-p

Re: [R] Help with abs function

2015-06-12 Thread Sarah Goslee
explore a little bit and found > >> as.character(dgrid) > [1] "0.101" "0.2" > [3] "0.0996" "0.101" > [5] "0.0996" > > which shows the absolute values of

Re: [R] search across a row for strings

2015-06-15 Thread Sarah Goslee
ot > found: > > for (i in 1:nrow(df)) { > df[i,"htn"] <- any(sapply('410', function(x) which( grepl(x, df[i, 2:4], > fixed = TRUE) ))) > } > > Thanks in advance. I never fail to learn new things from this list. > -- Sarah Goslee http://www.funct

Re: [R] Replace values in a dataframe

2015-06-17 Thread Sarah Goslee
", 4/2, ifelse(mydata$Color == > "<5", 5/2, as.numeric(mydata$Color))) > mydata Color Unit NewColor 1:2 5 Hazen 5.0 1:3<4 Hazen 2.0 1:4 5 Hazen 5.0 1:5<5 Hazen 2.5 1:6 5 Hazen 5.0 This will throw a warning message that y

[R] help

2015-06-17 Thread Sarah Bazzocco
and BH(FDR) as genes there are. the same I would need to do for the sensitivity... and so on. Do you think this is doable? I am not at all a bioinformatic expert, so all help is very welcome. Thank you very much! Kind regards, Sarah -- Sarah Bazzocco, PhD student Group

  1   2   3   4   5   6   7   8   9   10   >