I have two problems when trying to add the value of a data point above the data point. I am trying to solve this with a for-loop:  \documentclass[12pt]{article} \usepackage{tikz} \usepackage{pgfplots} \pgfplotsset{compat=newest} \begin{document}  \begin{tikzpicture} \def \myvalues{{50,50,31,25,24,24,24,24,24,24,24,24,24,24,24}}%   \begin{axis}[     width=\textwidth,     height=.40\textwidth,     xlabel={x},     ylabel={y},     xtick={1,2,3,4,5,6,7,8,9,10,11,12,13,14,15},     ytick={20,25,30,35,40,45,50},     xmajorgrids,     ymajorgrids, ] \addplot [black, mark=*, mark options={solid}] table {% 1 50 2 50 3 31 4 25 5 24 6 24 7 24 8 24 9 24 10 24 11 24 12 24 13 24 14 24 15 24 };   \pgfplotsinvokeforeach{1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}{         \pgfmathparse{\myvalues[#1-1]};     \node at (#1,\pgfmathresult+2){\pgfmathresult};     }  \end{axis}   \end{tikzpicture} \end{document}   Problems:   Document compiles without errors, but the nodes don't show up in the plot. How can I add an if-statement into the for-loop? For example to change the color of the node to red for the nodes 4 and 12?   Thanks a lot!  -
Am hesitant to ask yet one more embarrassing question, but I can't seem to see the problem with the \foreach in the MWE. It should produce several horizontal lines but only produces the one with the yValue as specified in the \newcommand{\yValue}{0.3}:  Code: \documentclass{article} \usepackage{pgfplots}  \newcommand{\yValue}{0.3}  \begin{document} \begin{tikzpicture} \begin{axis} [  ymin=0,  ymax=1,  xmin=0,  xmax=1, ]  \foreach \yValue in {0.00,0.1,...,1.00} {     \draw [red] (axis cs:0,\yValue) -- (axis cs:1,\yValue); }  \end{axis} \end{tikzpicture} \end{document}
If a factor variable (e.g. gender with levels M and F) is used in the glm formula, dummy variable(s) are created, and can be found in the glm model summary along with their associated coefficients (e.g. genderM)  If, instead of relying on R to split up the factor in this way, the factor is encoded in a series of numeric 0/1 variables (e.g. genderM (1 for M, 0 for F), genderF (1 for F, 0 for M) and these variables are then used as numeric variables in the glm formula, would the coefficient result be any different?  Basically the question is: does R use a different coefficient calculation when working with factor variables versus numeric variables?  Follow-up question (possibly answered by the above): besides just the efficiency of letting R create dummy variables, is there any problem with re-coding factors as a series of numeric 0,1 variables and using those in the model instead? I used the prcomp() function to perform a PCA (principal component analysis) in R. However, there's a bug in that function such that the na.action parameter does not work. ; two users there offered two different ways of dealing with NA values. However, the problem with both solutions is that when there is an NA value, that row is dropped and not considered in the PCA analysis. My real data set is a matrix of 100 x 100 and I do not want to lose a whole row just because it contains a single NA value.  The following example shows that the prcomp() function does not return any principal components for row 5 as it contains a NA value.  d       &lt;- data.frame(V1 = sample(1:100, 10), V2 = sample(1:100, 10),                        V3 = sample(1:100, 10)) result  &lt;- prcomp(d, center = TRUE, scale = TRUE, na.action = na.omit) result$x                                # $ d$V1[5] &lt;- NA                           # $ result  &lt;- prcomp(~V1+V2, data=d, center = TRUE, scale = TRUE, na.action = na.omit) result$x   I was wondering if I can set the NA values to a specific numerical value when center and scale are set to TRUE so that the prcomp() function works and does not remove rows containing NA's, but also does not influence the outcome of the PCA analysis.  I thought about replacing NA values with the median value across a single column, or with a value very close to 0. However, I am not sure how that influences the PCA analysis.  Can anybody think of a good way of solving that problem? Defining scalable "white curly brackets" {| and |} (⦃ and ⦄) I would like to construct what Unicode calls "white curly brackets" that are in addition scalable. They look like ⦃ (≈{|) and ⦄ (≈|}) and have Unicode codepoints U+2983 and U+2984.  unicode-math has them as \lBrace and \rBrace, but (1) I don't presently use XeTeX or LuaTeX and (2) their design (shown in  on pages 3-4) is not to my liking: the brace part is too fat for my taste, and I would like the vertical bar to not leave any protrusions. I am trying to have them visually match the parentheses \llparenthesis, \rrparenthesis, \llbracket, and \rrbracket from stmaryrd.  Right now I am using a makeshift definition, which is sufficient for now, but the symbols don't scale (in general or with \left/\right). Here is sample code:  \documentclass{article} \usepackage{amsmath} \usepackage[only,llbracket,rrbracket,llparenthesis,rrparenthesis]{stmaryrd} % for comparison with 4 similar parenthesis symbols \usepackage{accsupp} % for ensuring the right Unicode codepoint upon pasting  \newcommand*{\llbrace}{%   \BeginAccSupp{method=hex,unicode,ActualText=2983}%     \textnormal{\usefont{OMS}{lmr}{m}{n}\char102}%     \mathchoice{\mkern-4.05mu}{\mkern-4.05mu}{\mkern-4.3mu}{\mkern-4.8mu}%     \textnormal{\usefont{OMS}{lmr}{m}{n}\char106}%   \EndAccSupp{}% } \newcommand*{\rrbrace}{%   \BeginAccSupp{method=hex,unicode,ActualText=2984}%     \textnormal{\usefont{OMS}{lmr}{m}{n}\char106}%     \mathchoice{\mkern-4.05mu}{\mkern-4.05mu}{\mkern-4.3mu}{\mkern-4.8mu}%     \textnormal{\usefont{OMS}{lmr}{m}{n}\char103}%   \EndAccSupp{}% }   \begin{document}  \noindent ok: \(\displaystyle\llbrace abc \rrbrace\) \(\textstyle\llbrace abc \rrbrace\) \(\scriptstyle\llbrace abc \rrbrace\) \(\scriptscriptstyle\llbrace abc \rrbrace\)  \noindent ok: \(\displaystyle \llbrace \frac{a}{b} \rrbrace\) \(\textstyle\llbrace \frac{a}{b} \rrbrace\) \(\scriptstyle\llbrace \frac{a}{b} \rrbrace\) \(\scriptscriptstyle\llbrace \frac{a}{b} \rrbrace\)  \noindent incorrectly scaled (\verb|\scriptsize|): {\scriptsize\(\llbrace abc \rrbrace\)} (large magnification required)  \noindent incorrectly scaled (\verb|\tiny|): {\tiny\(\llbrace abc \rrbrace\)}  \noindent \verb|\left| and \verb|\right| not possible before \verb|\llbrace| and \verb|\rrbrace|: \\ \indent \(\llbrace \left\llbracket\left\{\left[(a) \cdot bc^{2^3}\right]^4\right\}^5\right\rrbracket \rrbrace\) % Note: This is also not possible with \llparenthesis and \rrparenthesis from stmaryrd.  \noindent for comparison: \(\llparenthesis x \rrparenthesis, \llbracket x \rrbracket, \llbrace x \rrbrace; (x), [x], \{x\}\)  \end{document}   Lines 1 and 2 look just right with the present setup. Lines 3 and 4 demonstrate that my definitions don't scale. Lines 5a/b gives an example of where I would like to be able to use \left and \right. Line 6 juxtaposes different types of parentheses for visual comparison.  Is there an easy way to scale the glyphs I have constructed myself? Or is designing new glyphs the only way? While the vertical part of my glyphs doesn't leave any protrusions, the "brace part being too fat" part of my problem isn't being addressed by my code. With this in mind: I recognize that it might not be that easy to make the brace part of the glyph thinner (though if you can, more power to you), but I think that any solution that addresses the scaling problem for any manually constructed glyph cluster will be a valuable contribution to the community.    For a slightly different setup (original example code) with  \RequirePackage{fix-cm} \documentclass[12pt]{memoir} \usepackage{fixltx2e}[2006/09/13] \usepackage{amsmath} \usepackage{txfonts} \usepackage[only,llbracket,rrbracket,llparenthesis,rrparenthesis]{stmaryrd} \usepackage{accsupp}   in the preamble, one needs \mkern-5.7mu in the fourth argument to \mathchoice for "correct" scaling. To see what goes wrong in that case, it's best to include a line such as discontinuous small symbols in a footnote\footnote{\(\scriptscriptstyle\llbrace \frac{a}{b} \rrbrace\)}. This might help a potential answerer test things out. How do you use plural or singular form of an adjective? So I was taught that you should almost always use singular form of an adjective instead of plural form. But recently, I've seen people using plural form and it sounds quite weird and I don't know if it is correct.  For example,   "Salary tax" instead of "Salaries tax" "Office supplies" instead of "Offices supplies" "Product demo" instead of "Product demo"   In the above cases, the word "Salary" is used as an adjective to describe the type of "tax", so it will be in singular form. But I saw people using salaries tax and not sure if it is grammatical.  So my question is if there are any general rules on how to use the singular/plural form of an adjective? Accessing variables from other functions without using global variables I've heard from a variety of places that global variables are inherently nasty and evil, but when doing some non-object oriented Javascript, I can't see how to avoid them. Say I have a function which generates a number using a complex algorithm using random numbers and stuff, but I need to keep using that particular number in some other function which is a callback or something and so can't be part of the same function.   If the originally generated number is a local variable, it won't be accessible from, there. If the functions were object methods, I could make the number a property but they're not and it seems somewhat overcomplicated to change the whole program structure to do this. Is a global variable really so bad? How do you document your databases? Limit values of struct member If I have $f:\mathbb{R}\rightarrow\mathbb{R}$ such that $f$ is onto and $f\circ f\circ f = f$, how can I prove that $f$ is bijective? I know that I only have to prove that it is 1-to-1 because I'm given the fact that it's onto, but how can I use the fact that $f\circ f\circ f=f$ to prove that it is 1-to-1?  Thanks! If $A$ has two eigenvalues $\lambda _1, \lambda_2$ and $\dim (E_{\lambda_1})=n-1$, then $A$ is diagonalizable How do I grep for lines containing either of two words, but not both? I'm trying to use grep to show only lines containing either of the two words, if only one of them appears in the line, but not if they are in the same line.  So far I've tried  grep pattern1 | grep pattern2 | ... but didn't get the result I expected. Why exactly did the Sorting Hat originally want to put Harry in Slytherin? I have a map of a city and a .csv-file containing 700 geographic coordinates pointing to locations within that city.  How can I plot these 700 locations on the map? I live &amp; work in the UK.  Having pretty much exhausted all of the avenues I can find for saving (none of which have great returns anyway at the moment, obviously), I have recently started looking to buy my first house.  I have a reasonable sum saved up for a deposit, but I'm wondering what to do with that in the mean time, as a fair amount of it is not currently earning any interest. For the moment, I have put any surplus, that I'm not earning interest on into premium bonds, just in the off-chance that I win something with it, but this is obviously more of a lottery than an investment, and I'm not 'expecting' to win anything noteworthy with it.  Ideally, I would like to buy a house within the next year or so, so investing in the stock market is not really an option, as I understand the commonly accepted advice is that you invest with a minimum 5 year horizon.  What other options do I have for any surplus cash while I look for a house? The official currency of Hungary is the Forint but so far everything I have looked for prices online, such as trains, buses and taxis, are quoted in Euros and Forints. Hotel reservation asked that I pay in Euros at the hotel. Considering that I will only spend a few days in Budapest, are Forints necessary? Or can I pay for transport, admissions and food in Euros? In such a case, how is the conversion rate set? How to show/hide a column at runtime? I'd like to show/hide a column at runtime based on a particular condition. I'm using "Print when expression" to conditionally show/hide this column (and it's header) in my report. When the column is hidden, the space it would have occupied is left blank, which is not particularly attractive.  I would prefer if the extra space was used in a more effective manner, possibilities include:   the width of the report is reduced by the width of the hidden column the extra space is distributed among the remaining columns   In theory, I could achieve the first by setting the width of the column (and header) to 0, but also indicate that the column should resize to fit its contents. But JasperReports does not provide a "resize width to fit contents" option.  Another possibility is to generate reports using the Jasper API instead of defining the report template in XML. But that seems like a lot of effort for such a simple requirement. When writing answers on here, it's often necessary to create a new script and chmod +x it to make it executable. I won't go into whether this is a good thing or not, but explaining to people that they need to fire in three separate command (and teaching them to use nano!) is a bit of a waffle.  Is there anything easier? Let $V,W$ be two vector spaces over a field $F$ and let $f:V \to W$ be a linear mapping. I have going over some facts about vector spaces (not necessarily finite dimensional) and I have been trying to apply the rank nullity theorem to derive a simple lemma.  I have not been able to complete the proof and was wondering if I need to use something other then $\ker f + \mathrm{Im}\; f = \dim V$.  How do we show that for ever vector subspace $K \subset W$, $ \dim(f^{-1}(K)) = \dim(K \cap \mathrm{Im}\; f) + \dim( \mathrm{Ker}\; f)$? I'm more of a math guy than a physics guy so bear with me....  In fractal geometry, fractals are considered to have fractional dimension. For instance an object such as the Koch curve has a fractal dimension of around $1.2$. You can also define a concept called fractal extent (which is the experimental version of hausdorff measure). This extent is a measure of how large a fractal is. It's even been used to more accurately model the distribution of coastline bird nesting.   Even though fractals work as an interpretation of geometrical units, I don't think they would describe things such as $kg^{1/2}$ very well. In addition, I've heard about white Gaussian noise that has square root time units.   What is the physical meaning of fractional units such as the above? (Since it obviously has little geometric meaning) How to run shell script via terminal Debugging errors of SAGA interpolation algorithms in QGIS Processing?